How to set gravity for Mesh object of TransformNode class?

‘let carMesh: BABYLON.TransformNode = …’
How to set gravity for Mesh object of TransformNode class?

This is not per node, but at the engine level: Forces | Babylon.js Documentation

I have enabled physics for the current scene, and I can use the .physicsImpostor property to set impostors for individual meshes created with MeshBuilder().
But I’m using BABYLON.ContainerAssetTask method to batch import meshes and render them when needed, when rendering I get type BABYLON.TransformNode, I don’t know how to set impostors for these meshes, is there any code sample or tutorial?

Let me add @Cedric for this part

You have to check in your transform hierarchy which one is the mesh.
Usually, the first transform node is the root node and along the children hiearchy, there are the meshes.

Did you try to access loadedMeshes from ContainerAssetTask?

@Cedric

I have to add physics to the glb mesh. I am currently doing it by creating a box and adding it as a parent to the glb mesh and add physics.boximposter inorder to do physics properties .But there is a cache,the box mesh was added in the case of a sphere-shaped glb mesh too.

so insted of adding box or sphere to glb mesh ,can we directly add physics imposter to the transform node itself .i think it would be much simple ,i dont know how to do it ,need some help

@Cedric will be able to look in the new year :slight_smile: please bear with us during the vacations.

Using impostors with transform node instead of mesh is something I’m doing for the Physics V2 plugin interface.
It’s a big change that would break many things if applied to current plugin, so I’m starting every thing from scratch (more or less).
No ETA but I hope it will be available this quarter.

2 Likes