Rotate a part using body movers?


#1

Hello DevForum,

I am trying to figure out how to rotate a part up and down using body movers, but I don’t know which to use. I want to make this a single rotation, so I can rule out BodyAngularVelocity. I want to try something like:

If anyone knows a solution and what to use, please leave a comment below.

Have a wonderful day.


#2

Use BodyGyros to give parts a constant orientation.


#3

Okay thanks! Quick question, would that make my BodyForce move in the orientation of the BodyGyro?


#4

The body gyro can be used to orientate the part as needed. You can apply a bodyForce after wards to propel the part in that direction.


#5

No. Use BodyThrust if you’d like to apply a force relative to the orientation of a part or convert the force to local space with some CFrame magic. The Developer Hub provides an example:

Using the CFrame:vectorToWorldSpace(Vector3) method, it is possible to translate a force vector that is relative to the part into the world vector necessary for Force. For example, to apply a force to the left an object (no matter which way it’s facing), try:
magnitude = 100
left = Vector3.new(-1, 0, 0) * magnitude – You could also use Vector3.FromNormalId(Enum.NormalId.Left)
bodyForce.Force = bodyForce.Parent.CFrame:vectorToWorldSpace(left)


#6

To make the bodyforce move it in the direction its looking, just do BodyForce.Force = Part.CFrame.lookVector * Speed


#7

BodyGyro would not be my first, second, or third choice for this. The rotation about the end of the block suggests a hinge with motor or with AlignOrientation constraint. A Motor6D connected to an invisible anchored part could also be used if you need constant rotation speed (AlignOrientation is a PD controller, so it will have an easing-like acceleration).

BodyGyro is meant more for stabilizing something on one or more axes, it rotates something about its center of mass, so not ideal for something like a door or hinged part.