Hi guys, I’m trying to place an object on the ground but it won’t stop falling when it collides the ground. What am I doing wrong? Please help me, thanks
Your meshes[0] from .glb is a root-mesh without any vertices, so using BoxImpostor won’t work on root-mesh.
A similar issue is discussed here:
Or use AmmoJS like this:
With AmmoJS you could even just use MeshImpostor on root if I remember correctly.
A few things about your PG:
- I highly recommend using our V2 Physics API with Havok as it’s way more performant
- You shouldn’t create a physics object and use checkCollisions, as the latter is just for camera collisions and conflicts with the physics engine
- The UFO object is complex to treat with physics because it has skeleton animations, so I opted to stop all running animations to make handling easier.
- As Takemura said, the root mesh doesn’t have any vertices, so the impostor/aggregate creation won’t know its size. Instead of using the root mesh, I created a new parent for it that represents a collision box, and made it invisible, so the collisions will happen on this parent.
Here’s the updated PG with the changes: UFO Physics | Babylon.js Playground (babylonjs-playground.com)
2 Likes