# Setting up collision

Hi,

for some reason my PlayerModel is flying away (upward) from my world.
What am I missing?

[java]public void simpleInitApp() {
bulletAppState = new BulletAppState();
stateManager.attach(bulletAppState);

``````    speed = 10.0f;

//World
world.setLocalScale(2.0f);

CollisionShape worldcshape = CollisionShapeFactory.createDynamicMeshShape(world);
RigidBodyControl rworld = new RigidBodyControl(worldcshape,123.0f);
rworld.setGravity(new Vector3f(0f,-9.81f,0f));
rootNode.attachChild(world);

//Player
playerNode.attachChild(player);
CollisionShape playerShape = CollisionShapeFactory.createDynamicMeshShape(player);
RigidBodyControl plr = new RigidBodyControl(playerShape,120.0f);
plr.setGravity(new Vector3f(0f,-9.81f,0f));
plr.setMass(10f);

rootNode.attachChild(playerNode);
[/java]``````

1. youâ€™ve given the world itself mass, why? Are you sure its not the world falling away from you? â€śnew RigidBodyControl(worldcshape,123.0f)â€ť This constructor gives the world a mass of 123kg. Assuming you want the world stationary its mass should be 0 or it should be set as kinematic (the former unless theres a specific reason otherwise)
2. are you accelerating away from the world (indicating either the above, or a force is pushing you upwards) or are you violently thrown out of the world at what seems close to an infinite speed which would indicate that the player is in an illigal position (inside the world?) to start with and the physics engine is coping with that in the only way it can
3. why are you setting gravity on an object by object basis? This should be unnessisary unless different objects experience different gravity
2 Likes

nice explanations :). I think #1 is the most likely cause here