Skip to content

What is the correct way to clean up the removal of a constraint? #159

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

You must be logged in to vote

The proper sequence would be:

let body1 = <create and add a body>
let body2 = <create and add a body>

let constraintSettings = new Jolt.XXXConstraintSettings();
let constraint = constraintSettings.Create(body1, body2);
Jolt.destroy(constraintSettings);

physicsSystem.AddConstraint(constraint);

// simulate...

physicsSystem.RemoveConstraint(constraint);

// now you can remove and destroy body 1 and 2

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

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

@jrouwe
Comment options

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