godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.93k stars 21.15k forks source link

[Bullet] Bouncing vehicle loses velocity #47273

Open MrMinimal opened 3 years ago

MrMinimal commented 3 years ago

Godot version: 3.2.3-stable

OS/device including version: Linux

image

Issue description: A bouncing VehicleBody looses its jump energy after a couple of jumps with dampening set to 0.

Expected behaviour: The vehicle should keep bouncing indefinitely.

Steps to reproduce:

  1. Open demo project
  2. Run the project
  3. Observe the vehicle jump and the wheels leave the ground
  4. After ~16 jumps the vehicle doesn't have enough energy to leave the ground anymore

Minimal reproduction project: bouncy_demo.zip

Cykyrios commented 3 years ago

I'm not sure why, but it works if you change the default damp values in the project settings' physics category to zero. This is supposed to be overridden by the vehicle's RigidBody values, but they seem to be ignored.

pouleyKetchoupp commented 3 years ago

This is related to #42842, and the issue happens only in Bullet. It works as expected when switching the 3D physics engine to Godot Physics.

MrMinimal commented 3 years ago

This is related to #42842, and the issue happens only in Bullet. It works as expected when switching the 3D physics engine to Godot Physics.

I agree that the linked issue is the cause for the loss in velocity but switching to Godot Physics doesn't fix it. Bullet and Godot Physics both behave the same in this demo.

pouleyKetchoupp commented 3 years ago

@MrMinimal In the linked MRP, damping is set to -1 in VehicleBody, which means the default value from the world is used (0.1): https://docs.godotengine.org/en/stable/classes/class_rigidbody.html#class-rigidbody-property-linear-damp

It works as expected with GodotPhysics when setting the damping value to 0 in either the VehicleBody node or project settings.

With Bullet, the VehicleBody overriden value is actually added to the world default value, so you need to set the project settings value to 0 to allow the vehicle to bounce infinitely (due to #42842).

MrMinimal commented 3 years ago

@pouleyKetchoupp That's a good workaround but until #42842 is closed, I still consider this a bug. There are projects where you don't want to touch the project settings because that influences other nodes.