Adding physics to an object

Hi Guys! :slight_smile:
I created an object from the class “Entity” I made myself which holds a 3d model and a collision shape around it.
I guess that is all I need to make it a proper physics object.

So I thought this would do the job:
[java]
public void initObject() {
test = new Entity(assetManager, rootNode, “test”, 3, true, -5f, 30f, 1f);
CollisionShape modelShape = CollisionShapeFactory.createMeshShape((Node) test.model);
RigidBodyControl body = new RigidBodyControl(modelShape, 0);
test.model.addControl(body);
rootNode.attachChild(test.model);
bulletAppState.getPhysicsSpace().add(body);
}
[/java]

The RigidBodyControl seems to be very similar to the CharacterControl. At least I hope so :stuck_out_tongue: (The docu says so…)
So this should make the object fall onto the ground right?
I mean I did not more with the player, but the player has correct physics on it. I can even change things like
player.setGravity(…);
So I tried to do the same with my object but
modelShape.setGravity(…);
does not work here! So there is something that declares this object as “physical”. But I dont know how.
The documentation does not even list things like .setGravity(); for the player.
There is a difference between “RigidBodyControl” and “CharacterControl” but the documentation does not show any.

What am I doing wrong?
Cheers

  • Daniel

No, the character control has no gravity setting.