Why a moving mesh doesn't effect the mesh above it?

I have a scene with a “ground” moving below the “player”, everything is working as I want, but not as I expected, I mean, does the moving ground shouldn’t affect the cylinder, moving it to the left?

I’ve also tried to add some friction to it, but don’t work either. How could I make the ground affect the mesh above?

Playground link: https://playground.babylonjs.com/#2DIDW2#6

What way do you need that gound affects cylinder? parent→son or physic?

I believe its physic, at least move the cylinder to the left following the floor :thinking:

hello~ https://playground.babylonjs.com/#2DIDW2#8
it achieve move but have a bug
I think you shouldn’t use physic to achieve friction

you move ground, it is difficult and instable to calculate relational positon/velocity/force, I think you should move camera instead of move ground

In order to save more performance, we usually make most of collider static, only character’s collider can move

Hey @Moriy thank you for the tips and the playground fix! But why is needed to add more lines of code to achieve this? This is bugging me cause I thought the cylinder would move to the same direction as the ground, just like a moving mat, as we add physics impostor to both the meshes (ground and cylinder), shoudn’t the cylinder flow with the ground without any more code? :thinking:

I mean, why do we need to add a velocity on the physicsImpostor and change the mesh position too? I come from unity (but still now much experience) and there, when I move an element to the left, any other elements physically above this element follow the position of the below element, just like if I have a box with an apple above the box, the apple should still above the box, despite the direction I move the box, right? :thinking:

Do you know why this isn’t the behavior of babylonjs? I would like to understand this if possible so if you could explain or point out where on the docs have some explanation about this would be great :grin:

1 Like

Adding @RaananW and @Cedric to the topic

I think this could be because you are moving the background using JavaScript code not the physics engine.


It looks like an issue is that if the physics impostor’s mass is 0, then its corresponding mesh object is not moved by setting linearVelocity on the physics impostor.

For example, here’s a simple playground example of a sphere whose physics impostor has mass 1 being moved by setting its linear velocity.

And here’s the same playground with the mass changed to 0, and in this case the sphere doesn’t move (like your ground mesh whose impostor also has mass 0).

IDK what the solution is thou, because just changing your ground impostor’s mass from 0 creates lots of other complications… :thinking:

But it def seems like you should be able to comment out lines 144 and 145 that move the mesh manually, and just use the linear velocity to move both the impostor body and the mesh. IDK how to configure the impostor settings properly to achieve it thou…

1 Like

I think it is probably that your ground’s mass is zero, and your ground and player both are rigidbody, according to physic’s conservation of momentum, ground don’t has mass, it can not provide the decrease momentum to player?


yes, I think moving an impostor with code has no influence on contacts with other impostors. For the physics engine, nothing happens (as the ground is static) and collision happen at the same world position each frame.
Adding a force/impulse/linear velocity will make the contact different and you should see an interaction with the capsule.
That said, I agree the nature of static impostor is to be static.


Hey people, thank you for all the replies, it helped me a lot to understand the behavior of babylonjs!

This thread leaded me to more questions btw, but I believe the question right here were answered