Search in sources :

Example 1 with BroadphaseNativeType

use of com.bulletphysics.collision.broadphase.BroadphaseNativeType in project bdx by GoranM.

the class CollisionWorld method addCollisionObject.

public void addCollisionObject(CollisionObject collisionObject, short collisionFilterGroup, short collisionFilterMask) {
    // check that the object isn't already added
    assert (!collisionObjects.contains(collisionObject));
    Stack stack = Stack.enter();
    collisionObjects.add(collisionObject);
    // calculate new AABB
    // TODO: check if it's overwritten or not
    Transform trans = collisionObject.getWorldTransform(stack.allocTransform());
    Vector3f minAabb = stack.allocVector3f();
    Vector3f maxAabb = stack.allocVector3f();
    collisionObject.getCollisionShape().getAabb(trans, minAabb, maxAabb);
    BroadphaseNativeType type = collisionObject.getCollisionShape().getShapeType();
    collisionObject.setBroadphaseHandle(getBroadphase().createProxy(minAabb, maxAabb, type, collisionObject, collisionFilterGroup, collisionFilterMask, dispatcher1, null));
    stack.leave();
}
Also used : BroadphaseNativeType(com.bulletphysics.collision.broadphase.BroadphaseNativeType) Vector3f(javax.vecmath.Vector3f) Transform(com.bulletphysics.linearmath.Transform) Stack(com.bulletphysics.util.Stack)

Aggregations

BroadphaseNativeType (com.bulletphysics.collision.broadphase.BroadphaseNativeType)1 Transform (com.bulletphysics.linearmath.Transform)1 Stack (com.bulletphysics.util.Stack)1 Vector3f (javax.vecmath.Vector3f)1