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 );
}
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);
}