Hello,
I have a physics controlled scene with a box and a heightmap. Sometimes (not always, just try a couple of times) when the playground is executed the box receives an imulse and gets pushed away. I would expect that the box just gets dragged down accordig to the gravity vector. Note: if you select BJS 4.1.0 it always behaves correctly!
I just can’t explain why this happens, any help appreciated.
https://www.babylonjs-playground.com/#5ZEEF7#9
pinging @Cedric
I’m taking a look.
I can repro and it gets even more weird with ammojs. definitely something wrong is happening here.
I’m investigating.
I couldn’t repro with the latest nightly (5.0.0-alpha.2). Can you try it your side to see if it’s just me ?
@Cedric thanks for investigating! Do you know when alpha.2
is available in the palyground?
It is now.
I can still reproduce with alpha.2
on Win 10. Tested with latest chrome and edge. The box gets an impulse and is pushed to the left.
Allright, can you please test it with this PG : physics ground test | Babylon.js Playground (babylonjs-playground.com)
Now it works! I see you only changed the maxHeight of the ground from 20 to 19. Can you please explain why that is?
My guess is when the simulation starts, some collision detection happens more or less randomly. No idea how and why.
Ok, thanks, are there any plans to investigate this issue further?
Yes, I’ll continue investigating. it will take some time.
Ok, I’ll be patient Hoestly, I really appreciate your help!
Hi @Cedric I did some experimenting. Wrapping the assignement of the impostor in a setTimeout
fixes the problem. Even if timeout is 0
. Not that this is a solution but a workaround, at least for cannon:
https://www.babylonjs-playground.com/#5ZEEF7#11
I see. This almost confirms my guess that there is a 2 times initialization (impostor creation and then placement). I think I can find time to fix it this week. I’ll keep you posted.
That would be great Thanks alot!
Hi @Cedric did you had a chance looking into this? Regards
Hi @holger
sorry for the delay. I’ve put that task in my todo list for this week. I’ll keep you posted!