Floor collision

Hi everyone!

I´m trying to implement a floor with collision detection using either PhysicsNode and PlaneCollisionShape with a RigidBodyControl.

My first attempt was PhysicsNode and it was successful , however this class is deprecated, so I tried the new way using PlaneCollisionShape and RigidBodyControl, but I don´t know what is getting wrong. The codes are below:

:: This way is right, but its deprecated.

[java] private void createFloor() {

Geometry geo = BlockMaker.createFloorTexturedBlock(assetManager, "grass.png", 20, 20);

geo.setLocalTranslation(4, -0.1f, 6.2f);

PhysicsNode floor = new PhysicsNode(


new BoxCollisionShape(new Vector3f(20, 0.1f, 20)),






:: I have tried this one, but its does not works:

[java] private void createFloor() {

Geometry geo = BlockMaker.createFloorTexturedBlock(assetManager, "grass.png", 8, 8);

geo.setLocalTranslation(4, -0.1f, 6.2f);

Plane plane = new Plane(geo.getLocalTranslation(), 0);

PlaneCollisionShape cs = new PlaneCollisionShape(plane);

RigidBodyControl body = new RigidBodyControl(cs, 1);

body.applyForce(Vector3f.UNIT_Y, geo.getLocalTranslation());







I also have tried BoxCollision but the floor falls down into the space. Any clue will be very appreciated.

Thanks in advance and sorry about my english!

First, it’s not needed to do “body.setSpatial(geo);”, when you add the control to the spatial, that method is already called. Also, never user “setLocalTranslation” for rigid body models, use “setPhysicsLocation” instead.

1 Like

Thanks for reply, Glauco,

I thought it is necessary to add geometry to the body.

I will try your tip to move the object instead to use “setLocalTranslation” maybe that is the point breaking the floor behavior.