In learning physics engines, I cannot determine if there is a bug or it`s my question.
In official cases,it is very normal
new BABYLON.PhysicsAggregate(box, BABYLON.PhysicsShapeType.BOX, { mass: 1 }, scene);
I am trying to use my own understanding to implement this case study.
Firstly I implemented it on PG, the hpBodyId property reported an error
and then, I implement this function in a local environment,
I tried debugging and didn’t find the problem about the hpBodyId, It does indeed have value
But my experiment was also unsuccessful,the second parameter instanceIndex of setMotionType and setMassProperties did not fulfill its intended function
I think I see what’s going wrong.
1 box and 1 physics body are created and then instances are added 1 by 1.
But the physics is not updated to take these new instances.
I’d suggest to add the mesh and all its instances and then to create the physics body.
you are right
At first, I didn’t understand. I tried as you told me, and there was no problem
there is a sequence of setting between objects and physical body