How to get the angular impulse needed to bring an object to stop at a specific orientation?

Let me explain the question first:
I have a part that is rotating in air, like this. It’s just normal physics, things rotate while in the air.
RobloxStudioBeta_qteQWB8tMS

I want it to keep its angular momentum, and slowly stop itself from rotating to get to a specific orientation (the blue part’s orientation in the gif).

Here’s what it looks like, when it’s just slowly coming to a stop:
RobloxStudioBeta_TvbmbIRHYU

RunService.Heartbeat:Connect(function(deltaTime: number) 
	do -- drag to stop
		if p.AssemblyAngularVelocity.Magnitude > 0 then
			p.AssemblyAngularVelocity -= p.AssemblyAngularVelocity * 4 * deltaTime	
		end
	end
end)

It stops, but not at the orientation I want it to.

I tried using an AlignOrientation, but it doesn’t really achieve the effect I want:
(first part with RigidityEnabled, second part without)
RobloxStudioBeta_2t0XxVif5x
The part looks like it’s being pulled back towards the target orientation, as if taking the shortest route instead of its current angular velocity… it should look natural, that is, it considers the angular momentum of the object.

How can that effect be achieved? I’m thinking it should be achievable with some advanced physics and math trickery the same way you can calculate the velocity (or jump force) needed to jump to a certain height, but i just can’t wrap my head around it haha

1 Like

What you want is not a fancy math solution to perfectly apply a force. What you want is simply an AlignOrientation constraint.

You can choose to enable it when the cursor releases, and by tuning it’s properties you can retain a lot of your momentum while also having the rest state be exactly the same every single time.

I suggest trying to work on your properties, maybe you aren’t in the right mode?

2 Likes

Exactly as @repgainer3 said.
Try decreasing your Forces in the AlignOrientation so it acts as a brake and doesn’t align it instantly.
Also decrease your Responsiveness so the Constraint doesn’t try to react instantly.

1 Like