I have created a very simple scene with just a single RigidBody in it. My whole code is below:
extends RigidBody
func _ready():
self.apply_central_impulse(Vector3(1, 0, 0))
self.gravity_scale = 0
self.linear_damp = 0
self.friction = 0
func _integrate_forces(state):
print("v", self.linear_velocity)
The only thing that happens is a single force impulse at the beginning.
What I expected to happen then was that (in absence of gravity, dampening, and friction) it will maintain constant speed (as no other forces act on it).
However what I am observing is linear_velocity continuously becoming smaller. I.e. output is:
--- Debugging process started ---
Godot Engine v3.4.4.stable.official.419e713a2 - https://godotengine.org
OpenGL ES 3.0 Renderer: NVIDIA GeForce RTX 2070 SUPER/PCIe/SSE2
OpenGL ES Batching: ON
v(1, 0, 0)
v(0.998333, 0, 0)
v(0.996669, 0, 0)
v(0.995008, 0, 0)
v(0.99335, 0, 0)
v(0.991694, 0, 0)
v(0.990042, 0, 0)
v(0.988392, 0, 0)
v(0.986744, 0, 0)
v(0.9851, 0, 0)
What is causing my RigidBody to slow down?
P.S. that is cross posted from Godot Q&A https://godotengine.org/qa/133003/what-is-slowing-down-rigidbody, whichever place gets answer first I will try to remember to update the other one.
There is a linear damp configuration in Project Settings -> General -> Physics -> 3D -> Default linear damp. And it is being applied to your RigidBody
. If you set the default linear damp to zero, the slowing down effect goes away.
This also appears to be a difference between Bullet and GodotPhysics, since switching to GodotPhysics also makes the slowing down effect go away.
And yes, this goes against the documentation, since according to it you would have to set a linear damp of -1 to get the default one.
Thus, you can consider this a bug, feel free to open a bug report at https://github.com/godotengine/godot/issues - I have seen other bugs of the kind, where GodotPhysics works as advertised but Bullet (or its integration into Godot) has some quirks.
Edit: actually, there seem to be bugs about Bullet and dampening open already: