Open ffdead opened 2 years ago
Adding the instance index in the onCollide
callback sounds like a doable change.
Unfortunately exposing the cannon-es
physics bodies isn't possible though, as the bodies are created inside a web worker.
If you're referring to exposing the physics body APIs returned from the body hooks, that would be doable! Just dawned on me that you might be referring to that.
If you're referring to exposing the physics body APIs returned from the body hooks, that would be doable! Just dawned on me that you might be referring to that.
Ah yes, I think that would be enough - sorry for being unclear. The purpose would be to be able to reach to a colllision event and add forces manually or modify the position of the bodies that collided.
I'm looking for a way to reset the position of an InstancedMesh when it collides with a ground plane. So when it collides, I would want to update the position and velocity of that instance's physics body.
But it seems there is no way to get the current instance index from the
onCollide
callback. Similar question here: https://github.com/pmndrs/use-cannon/discussions/106Would it be possible to directly expose the physics bodies in addition to the Object3D in the CollideEvent?