I have issues placing an existing physics body (body.position..., body.rotation...) in the scene after it was set up with its impostors (like bringing a race car back on track or so). How is it supposed to be done? For me, weird things do happen:
rotation is not respected
the object receives spooky angular velocity (only Cannon)
This can be fixed by moving your meshes at the desired position before. https://playground.babylonjs.com/#K5T17W#2
It works fine with Oimo and Ammo as well.
TBH, I don’t know exactly why it’s happening after moving the root or why setting the velocity/torque to 0 doesn’t reset it properly.
Yes @Cedric, before works, that’s what I did in my PG, just commented out.
The problem is before can be only done once … before.
What about a racecar constructed of a couple of meshes and impostors (and collision listeners on impostors and and and…). Once the car crashed, it needs to be set back in the racetrack.
Sounds like a pretty common use case to me.
It’s pretty unelegant but I think it’s the best solution so far. Physics states will be cleared and I’m not sure it’s really a performance issue. Did you try it already?