Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how to cframe a brick from a angle like the cmdutl "selectEdge" ??

I want to do a cframe script like open door in 90° by click detector and click again to close .

1 answer

I'm not an uber nerd expert but here goes nothing.

In order to do this, you need to understand Trigonometry (sine and cosine)

I'll explain.


local radiusOfCircle = 50

for i=0, 360 do

	local xPoint = radiusOfCircle*math.cos(math.rad(i)) -- math.cos is the cosine function for trigonometry, which takes a radian input. Use math.rad to turn degrees into radians
	local yPoint = radiusOfCircle*math.sin(math.rad(i)) -- Same as above, but math.sin is for sine.

end

That will give you a coordinate of a point on the circumference of a circle.

You can apply this to CFraming to achieve your desired effect.

I've no time to write out that code, but play around with the above code and I'm sure you'll find something out.

Remember that Roblox calculates rotation with the same trigonometry.

1 comment

0

Thank you !!!

This discussion is preserved as it was. New answers, comments, and votes are closed.