[SOLVED] Physics Question

I have a physic question. Example of what I have below. I great a box and place it into the world. It is a door. I put physic on it so you can’t walk through it. Then I add a control to it, so when the player hits a key to open the door. The door slides to the right, but the physics doesn’t slide with it. The door slides, but the physics does not.

		Box box = new Box(SPOT_WIDTH, SPOT_HEIGHT - 0.6f, 1); 
		SpriteGeometry wall = new SpriteGeometry("wall " + x + "," + y, box, 8, 32);
		material = new Material(getApplication().getAssetManager(), "Shaders/shading/SpriteSheet.j3md");
		material.setTexture("DiffuseMap", getApplication().getAssetManager().loadTexture("Textures/sheet.png"));
       	wall.addControl(new RigidBodyControl( 0));

Here is a picture with door closed.

Then after the door is open.

I have physics debug on and the outline for the door is still there, it didn’t move with the door.

What did I do wrong?

What did you slide? You didn’t show the code that moves the object.

As a guess, probably you moved the spatial instead of the rigid body.

Thanks. That is what I did.

1 Like