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

Adding physics bodies at run-time might cause run-time pauses due to an existing hack relating to Jolt physics. #958

Open
bryanedds opened this issue Feb 19, 2025 · 0 comments
Labels
performance issues or potential issues relating to performance physics

Comments

@bryanedds
Copy link
Owner

Hack described here - jrouwe/JoltPhysics#1520 (comment)

Not sure how to address this other than to find some way to batch create physics bodies as prescribed in the above issue.

I get the feeling that the involved run-time pauses might not even be noticeable tho.

Related hack code here -

// HACK: optimize broad phase if we've taken in a lot of bodies.
// NOTE: Might cause some intemittent run-time pauses when adding bodies.
physicsEngine.BodyUnoptimizedCreationCount <- inc physicsEngine.BodyUnoptimizedCreationCount
if physicsEngine.BodyUnoptimizedCreationCount = Constants.Physics.Collision3dBodyUnoptimizedCreationMax then
physicsEngine.PhysicsContext.OptimizeBroadPhase ()
physicsEngine.BodyUnoptimizedCreationCount <- 0

@bryanedds bryanedds added performance issues or potential issues relating to performance physics labels Feb 19, 2025
@bryanedds bryanedds changed the title Adding physics bodies at run-time might cause run-time pauses due to an existing hack fix relating to Jolt physics. Adding physics bodies at run-time might cause run-time pauses due to an existing hack relating to Jolt physics. Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance issues or potential issues relating to performance physics
Projects
None yet
Development

No branches or pull requests

1 participant