BodyGyro forces acting against each other

I need these forces to act together to make the part rotate up at a fixed angle and continually rotate right forever.
the following lines are both in a while loop:

script.Parent.BodyGyro.cframe = script.Parent.BodyGyro.cframe * CFrame.fromEulerAnglesXYZ(0, -.05, 0)
–Continually rotate part

in another script:
script.Parent.BodyGyro.CFrame = cframe.fromEulerAnglesXYZ(0.05,–what goes here to keep the Y above?, 0)
–rotate X axis to make part face up, how to keep the other Y axis rotation so it doesn’t collide forces?

I use CFrame.Angle and math.rad() for rotation. This way i can write an angle in degrees which is a lot easier than using radians.

I would however recommend you look into the new body movers.

If you mess around with these you will likely find a combination that works for whatever you’d trying to do.

If you really want to use BodyGyros, then it will get a bit more complicated:

Ideally, you would use one BodyGyro that is moving as if it’s being affected by 2 forces. Controlling them from one place is the easiest way to go about this.

                                                                               -- x and y rotation calculated together.
script.Parent.BodyGyro.cframe = script.Parent.BodyGyro.cframe * CFrame.fromEulerAnglesXYZ(.05, -.05, 0)

If you really want to use two scripts, I can point you towards math.atan2, which is how you can calculate a single axis from a CFrame like you want to.
http://wiki.roblox.com/index.php?title=Global_namespace/Mathematical_functions#math.atan2

You will need to understand basic trigonometry and cframes to really do this though.

Here is an explanation that you can look into if you want to follow this route:

1 Like

alrighty, ty!

3 Likes