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

Constant Rotation using BodyGyro?

Asked by
ZeroBits 142
9 years ago

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

Log in to vote
1
Answered by
aalok 20
9 years ago

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!

0
this should explain my problem better http://i.imgur.com/tQ9DIQa.png ZeroBits 142 — 9y
Ad

Answer this question