Can't find the source of an angular friction

Hello developers, I am currently working on a boat driving system and have stumbled upon some weird behavior.

The first thing I do is adding an anti-gravity force to the part to prevent any kind of friction. This does remove linear friction. However, when using a torque constraint, there appears to be some kind of friction slowing down the part after removing the torque. This can be seen in the video below. The output shows the acceleration in each frame:

This is the code I’m using to measure the acceleration is the following:

local part = script.Parent
local lastVelocity = 0

game:GetService("RunService").PreSimulation:Connect(function(step)
	local v = part.AssemblyAngularVelocity.Magnitude
	
	local deltaV = v - lastVelocity
	
	local a = deltaV / step
	
	print(string.format(".%5f", a))
		
	lastVelocity = v
end)

This is the place file where the problem can be easily seen:
angularfriction.rbxl (56.7 KB)

Any help is appreciated!

All rotating parts, even those without any friction or forces acting on them, are subject to some internal damping of angular velocity that’s just built into the physics engine. It’s normal behavior for the part to lose approximately 5 percent** of its angular velocity per second. You can’t disable this, you’ll need to actively cancel it out with a constraint or script if you don’t want this to happen. Probably the best thing is to have a simple constant AngularVelocity constraint that you toggle on when the torque is toggled off, which just preserves the current value.

**Actual loss in percent is -100*math.log(0.95) or about 5.12933. But AFAIK this is some kind of physics engine stability tuning parameter, that could be subject to change at any time.

1 Like

Thanks a lot for the information!

Does this appear in the roblox documentation or is it from somewhere else?

It’s not documented as far as I know. You’d have to sample the angular velocity of a part as it decays and do an exponential regression to get the decay constant, i.e. the value of k that makes the curve v(t) = v0*e^(-kt) fit your measured sample points. In fact this curve fitting is simple enough that you only need one sample point besides the starting v0, for example, the time at which the velocity hits half v0 (the half life). Any two points will give you the unique solution.

1 Like