CollisonObjectWrapper find if RigidBody goes through hole

Post Reply
lukethor
Posts: 3
Joined: Tue Mar 27, 2012 10:26 pm

CollisonObjectWrapper find if RigidBody goes through hole

Post by lukethor »

In my dynamic physics world -- see attached image -- I have two objects. One is a Table rigidBody, CF_KNEMATIC_OBJECT that spins in the physics world over its own center. The other object is rigidBody with CF_CUSTOM_MATERIAL_CALLBACK flag, that can go through the holes, each one of the holes having a different score.

Would it be possible to determine when the coin goes through the holes by using the bullet physics ?. I have done it by using math, but I want to use physics if possible.

The coin constructor is as follows :

Code: Select all

public Coin(Vector3 pos) {
   super("coin","data/models/coin.xml", pos, 1.0f);
   boxDims = box.getDimensions();
   blockShape = new btBoxShape(new Vector3(0.51f, 0.51f, 0.51f));
   Vector3 halfExtents = new Vector3(boxDims.x/2,boxDims.y/2,boxDims.z/2);
   shape = new btCylinderShape(halfExtents);
   shape.setMargin(0.2f);
   rigidBody = FrogzillaPhysics.constructRigidBody(shape, 1, position.x, position.y, position.z);
   rigidBody.setCcdSweptSphereRadius(0.001f);
        rigidBody.setGravity(new Vector3(0f,-9.8f,0f));
        rigidBody.setCollisionFlags(rigidBody.getCollisionFlags() | CollisionFlags.CF_CUSTOM_MATERIAL_CALLBACK );
}
The knematic Table constructor is as follows :

Code: Select all

public TableTop(String modelPath,String convexDecompositionPath,Vector3 pos) throws IOException {
  super("TableTop", modelPath, pos);
  shape = FrogzillaPhysics.constructCompoundShapeFromDecomposition("data/models/table_holes.acd.obj",position.x, position.y, position.z, 1.0f);
  rigidBody = FrogzillaPhysics.constructRigidBody(shape, 0.0f, position.x, position.y, position.z)
  rigidBody.setCollisionFlags(rigidBody.getCollisionFlags() | CollisionFlags.CF_KINEMATIC_OBJECT );
  rigidBody.setActivationState(gdxBullet.DISABLE_DEACTIVATION);
  rotationSpeed = 1.0f / 5.0f;
  FrogzillaPhysics.addRigidBody(rigidBody);
}
Attachments
Game collision shapes
Game collision shapes
CoinCollisionShape.png (88.02 KiB) Viewed 6503 times
Post Reply