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

Constant Rotation using BodyGyro?

I made a turret that I wanted to point straight up, so I used this code to have it do so:

game.Workspace.CBarrel.Aim.cframe = CFrame.Angles(math.rad(90),0,0)

when I rotate the turret 90 degrees clockwise so that instead of pointing north, it pointed east, it stopped pointing up, and started pointing straight ahead, a further 90 and it started pointing down, what can I do to have it pointing up, using BodyGyro, no matter what it's Y rotation is?

edit; here is a visualization of my problem: http://imgur.com/etTFhJB.png

1 answer

Using that picture, it seems that you want to calculate the inverse of what you have rotated (I may be wrong) so you would use this little body of code:

local CF = CFrame.new(whateverpath.cframe)
print(CF:inverse())

If that is not what you wanted, please comment!

1 comment

0

this should explain my problem better http://i.imgur.com/tQ9DIQa.png

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