Godot: Bullet PR: motion logic is frame dependent

Created on 4 Nov 2017  路  3Comments  路  Source: godotengine/godot

Operating system or device, Godot version, GPU Model and driver (if graphics related):
Ubuntu 17.04, debug_release build fd6bae9f9a3ffc81f57e8aa3cc4e01f9bbdc726c

Issue description:
Motion in old Godot physic engine was frame independent. This means that independently from current physic frame-rate, the movement was acting more or less the same. (amount of traveled distance will be the same at 60fps and 10fps).
This is not the case for Bullet: when I set physics frame-rate to 10fps motion will be "six times slower" than with 60fps, just like the delta time is not taken into account somewhere.
Also setting Engine.set_time_scale() don't have any influence on Bullet physics engine motion (that means the rest of the game might work at x times slower/faster rate while physics is always working at the same speed rate).
VIDEO: https://youtu.be/_WJF2xbpPAA

Steps to reproduce:
Simple manual way:

  1. Create rigid body.
  2. Add some visual to it (like MeshInstance with predefined geometry)
  3. Add camera setup
  4. Run the project, observe how fast rigid body drop
  5. Go to Project->Project Settings->Physics->Common
  6. Set "Fixed fps" parameter to 10
  7. Run the project again, test with old Godot physics and Bullet
  8. Reset "fixed fps" to 60 and run Engine.set_time_scale(10.0) somewhere in the project
  9. Observe no change in Bullet physic

More advanced way with character controller:

  1. Download sample project.
  2. Test it on various "Fixed fps" settings on both physics engines (beware that you need to uncomment gravity apply line in Hero.gd when using Godot physic engine)

Link to minimal example project:
v2FpsMotionTest.zip

bug physics

Most helpful comment

Fixed: 6ee7101

All 3 comments

@AndreaCatania please don't bite! :smile:

Fixed: 6ee7101

As far as I tested it works nicely now! :+1:

Was this page helpful?
0 / 5 - 0 ratings