Hey everyone, I’ve been scouring the forums for an answer but I’ve yet to find a good method to limit the rotVelocity of a part. I have a block suspended by a BodyPosition and allowed to freely rotate under the weight of players, however I don’t want the block to spin so fast that it knocks players off. I’ve tried setting the rotVelocity to the last known rotVelocity Vector if the Magnitude rises above a certain number (let’s say 3) but it was very jerky. I also tried using BodyGyros but I those only return the block to the original orientation, and do not let it freely spin. Does anyone have a solution?
1 Like
Add in a TorqueActuator and write a linear controller in which a Torque is generated in order to slow down the part when above a certain rotational speed.
You can do this trivially with a linear piece wise function.
if math.abs(rot_velocity) > rot_velocity_limit then
u_torque = k * math.abs(rot_velocity) * math.sign(rot_velocity)
end
1 Like
Couldn’t quite get it to work reliably, it would rotate the block back a little bit but then stop applying torque even if the magnitude was way higher than the limit. By TorqueActuator do you mean the constraint torque object?
Your script will only apply Torque on (50, 50, 50). Change it so it is simply a scalar * -1 * Unit.