Odd slowdown with 1k+ FPS
Posted: Fri Oct 12, 2018 1:32 am
Hello! So, sparing long stories and non-sequiturs, I've come across an issue that I can't quite seem to fix. Upon entering a scene/map that my engine renders over or around 1000 FPS my player character moves extremely choppy, as do all other actors present. This changes slightly if I play around with stepSimulation values - choppy, extremely slow but constant movement, weird angular values - and setting them to higher values simply just lowers the FPS to the point where it acts as expected which is also undesirable. My main loop is set up ala Gaffers timestep/what was boilerplated on the wiki.
I'm using Lua for my actors and have made a bit of the Bullet functions available to it via LuaBridge, so I'm calling the relevant functions directly. As for how I'm doing movement, every actor has an assigned rigid body; some have additional rigid bodies for things like hitboxes etc. I use setLinearVelocity for whichever actor is moving, and have it set immediately to the actors maximum movement speed for now. I've read setLinearVelocity begins to function oddly at higher/lower frame rates; swapping to applyImpulse and applyForce both did not achieve the desired movement effect and also had the same problems at higher frame rates. I'm kind of at a loss - the only thing I can think of is the collision callback is clearing forces quicker than they can be reapplied but with the mediawiki down I've been having trouble verifying if that was mentioned on the old articles, or if that's indeed what occurs (and as such if there's a better callback setup than what was given on the wiki.) Thanks so much!
EDIT: Forgot to mention I'm using the 2.87 release of Bullet!
Code: Select all
while(run)
render
get current time
pass delta time to stepSimulation
scene events(things like running timers/callbacks, locking rigid bodies to mesh bones etc.)
dt-game tick (set to 8)
while(dt>=game tick)
input polling
scene update (movement, ai decisions, setting states/animations)
gl swap
EDIT: Forgot to mention I'm using the 2.87 release of Bullet!