Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 10 years ago

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

1 answer

Log in to vote
0
Answered by
Elttob 15
10 years ago

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.

0
Thank you !!! ColesLee0 0 — 10y
Ad

Answer this question