Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

callback like fixedupdate of unity? #47

Open
fredlllll opened this issue Mar 28, 2018 · 1 comment
Open

callback like fixedupdate of unity? #47

fredlllll opened this issue Mar 28, 2018 · 1 comment

Comments

@fredlllll
Copy link

i would need a callback like fixedupdate from the physics engine. can i just use fixed update or is there something hidden somewhere?

is the BPhysicsWorldLateHelper doing the stepping of the physics engine? but why is it done both in update and fixedupdate?

@Phong13
Copy link
Owner

Phong13 commented Mar 28, 2018

Hi Fred, yes, you can used Fixed Update. The design is for BPhysicsWorld to execute early and fire the collision events. Then BPhysicsWorldLateHelper executes late and steps the simulation. You can check the Script Execution Order settings to see. The Simulation is stepped in Update as well as FixedUpdate for interpolation. Notice that deltaTime is being passed in as the first argument and that StepSimulation returns numSteps. The simulation step only triggers if enough time has elapsed to cross an m_fixedTimeStep boundary. You might have multiple Update called between m_fixedTimeStep calls. Or you might have a very slow frame and StepSimulation needs to do multiple StepSimulation steps to catch up. Calling StepSimulation in Update lets Bullet interpolate the positions. Without it there can be visible jitter caused by Update and FixedUpdate being out of synch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants