Local "AngularVelocity"

I’m rotating an object on the Y axis using angular velocity. I need it to rotate locally instead of globally though. My current code looks like this:

self.Root.Thruster.BodyAngularVelocity.AngularVelocity = Vector3.new(0, self.Yaw * 5, 0);

It works fine until the part get’s rotated where it’s not pointing directly forward and up right. I’ve tried what seems to be all the different CFrame operations for converting the global value to the local variant( PointToObjectSpace, VectorToObjectSpace, ect). My biggest issue is not knowing what function to use to begin with. Any advice would be helpful!

1 Like

All you need to do simply is convert the Vector3 to world space and it will then become relative to the object in question.

I recently did this in order to add relative rotational force for a zero g control system.

self.Root.Thruster.BodyAngularVelocity.AngularVelocity = self.Root.Thruster.CFrame:VectorToWorldSpace(Vector3.new(0, self.Yaw * 5, 0))

Try it and see if it helps. Roblox has a great example of relative vs world oriented force calculation here: https://developer.roblox.com/en-us/api-reference/class/BodyForce

Best of luck!

2 Likes

It turns out I tried that, I just forgot to set the MaxTorque on the X and Z axis.