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

How do i script CFrame Straight Rotations?

I'm currently scripting CFraming, and I have no idea how to do a full rotation. I understand how to script rotating CFrames, but the point being it is always a bit off. Any help??

1 answer

✓ Accepted answer

Hi iPhoneDrew,

CFrame rotations become much easier when you start using the .Angles constructor of CFrame and start using math.rad()

###Well, I'll just show you a simple example here of how it works.

local part = workspace.Part -- The part you're rotating.

part.CFrame = part.CFrame * CFrame.Angles(0, math.rad(360), 0) -- This will do a full rotation since it just rotates 360 degrees, which is a full circle.

###math.rad() takes degrees and returns the degrees in radians. You could also use math.deg() which takes radians and returns it in degrees, but I am more familiar with degrees so I just used math.rad(). Anyways, that's how simple rotation can be.

##I hope I helped and have a wonderful day/night.

Thanks,

Best regards,

~~ KingLoneCat

2 comments

0

Thank you sooooo much!

0

No problem.

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