Physics Aggregate vs Physics Body

Hello, I was wondering if someone could help me with basic physics. I read through the physics documentation and it seems to all makes sense, however in practice I can’t seem to use the static PhysicsMotionType.

The physics documentation describes both physics bodies (as well as outlining the importance of using static flags). I don’t understand the difference between them and why the boxes go through the floor when I use PhysicsBody. (Using PhysicsBody for either the wall/floor or boxes makes the boxes go through the floor, I need to use aggregates for both the floor/wall and the boxes for it to work).

I’m a bit confused about how to make the the boxes respond to the floor, or mark the aggregate as static (maybe my understanding of the whole thing is flawed).

Here are the boxes correctly dropped down into the world (again, I need to use aggregates for everything for this to work).

Thank you for taking the time to read.

Hi @brandon-xyz and welcome to the forum!

There are 3 types of motion

  • static: nothing moves
  • kinematic: animation is controlled outside of physics (like automatic door controlled by an animation Curve in Blender)
  • dynamic: it moves and controlled by physics engine

More explanation here : Physics V2 core concepts | Babylon.js Documentation

As a shortcut and to be consistent with physics V1, settting mass = 0 makes the physics body to be static

1 Like

Thank you!

So yes, that link you mentioned refers to using PhysicsBodies, and that’s what I’m wondering about.

For example if I add this to the scene as outlined in that link.


		const sphere = BABYLON.MeshBuilder.CreateSphere("sphere");
		sphere.position.y = 100;
		const body = new BABYLON.PhysicsBody(sphere, BABYLON.PhysicsMotionType.DYNAMIC, false, scene);


		body.setMassProperties({
			mass: 1,
		});

It will simply fall through the floor, when the other objects stop on top of it.

Can you share the scene in a Playground so we can take a better look?