jBullet Collision/Physics not working as expected

Posted by Kenneth Bray on Game Development See other posts from Game Development or by Kenneth Bray
Published on 2012-10-21T21:03:07Z Indexed on 2012/10/26 23:19 UTC
Read the original article Hit count: 250

Below is the code for one of my objects in the game I am creating (yes although this is a cube, I am not making anything remotely like MineCraft), and my issue is I while the cube will display and is does follow the physics if the cube falls, it does not interact with any other objects in the game. If I was to have multiple cubes in screen at once they all just sit there, or shoot off in all directions never stopping. Anyway, I am new to jBullet, and any help would be appreciated.

    // Constructor
public Cube(float pX, float pY, float pZ, float pSize)  {
    posX = pX;
    posY = pY;
    posZ = pZ;
    size = pSize;
    rotX = 0;
    rotY = 0;
    rotZ = 0;

    // physics stuff
    fallMotionState = new DefaultMotionState(new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), new Vector3f(posX, posY, posZ), 1)));
    fallRigidBodyCI = new RigidBodyConstructionInfo(mass, fallMotionState, fallShape, fallInertia);
    fallRigidBody = new RigidBody(fallRigidBodyCI);
}

© Game Development or respective owner

Related posts about java

Related posts about collision-detection