-1

What would it be the way to execute code in each step (solve) of box2d instead of once per frame.

karacas
  • 2,054
  • 1
  • 19
  • 29

1 Answers1

2

Is this what you meant?

var box2DListener = Box2D.Dynamics.b2ContactListener;
var ContactListener = new box2DListener;
ContactListener.PreSolve = function(contact, oldManifold) {
  // some code to be executed before each solve
}
ContactListener.PostSolve = function(contact, impulse) { 
  // some code to be executed after each solve
}

It was also covered in Box2dweb - Collision Contact Point thread

You can find some good examples in Seth Ladd's Blog and TheNightOwl's Blog.

Community
  • 1
  • 1
TildalWave
  • 1,677
  • 1
  • 14
  • 20