Skip to content

How to activate bodies from a step listener? #784

Answered by jrouwe
hhyyrylainen asked this question in Q&A
Discussion options

You must be logged in to vote

The assert JPH_ASSERT(body.IsInBroadPhase()); means that you're trying to activate a body that hasn't been added to the PhysicsSystem (using BodyInterface::AddBody).

If you want a body to wake up when applying an impulse you need to call BodyInterface::AddImpulse instead of Body::AddImpulse. Otherwise you can indeed start accumulating velocity on a sleeping body (and if the body hasn't been added to the world it's the same thing). I'll have to add an assert there.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@hhyyrylainen
Comment options

@hhyyrylainen
Comment options

Answer selected by hhyyrylainen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants