Package com.bulletphysics.collision.shapes

Examples of com.bulletphysics.collision.shapes.CompoundShape


        }
      }
      else {
        // todo: use AABB tree or other BVH acceleration structure!
        if (collisionShape.isCompound()) {
          CompoundShape compoundShape = (CompoundShape) collisionShape;
          for (int i = 0; i < compoundShape.getNumChildShapes(); i++) {
            Transform childTrans = compoundShape.getChildTransform(i, Stack.alloc(Transform.class));
            CollisionShape childCollisionShape = compoundShape.getChildShape(i);
            Transform childWorldTrans = Stack.alloc(Transform.class);
            childWorldTrans.mul(colObjWorldTransform, childTrans);
            // replace collision shape so that callback can determine the triangle
            CollisionShape saveCollisionShape = collisionObject.getCollisionShape();
            collisionObject.internalSetTemporaryCollisionShape(childCollisionShape);
View Full Code Here


                shape.setCollisionSymmetric(true);
            }
        }

        private ColliderInfo processCompoundShape(List<ColliderInfo> colliders) {
            CompoundShape collisionShape = new CompoundShape();

            for (ColliderInfo collider : colliders) {
                Transform transform = new Transform(new Matrix4f(Rotation.none().getQuat4f(), collider.offset, 1.0f));
                collisionShape.addChildShape(transform, collider.collisionShape);
            }
            return new ColliderInfo(new Vector3f(), collisionShape);
        }
View Full Code Here

            Vector3f extents = box.getHalfExtentsWithMargin(new Vector3f());
            QuaternionUtil.quatRotate(rot, extents, extents);
            extents.absolute();
            return new BoxShape(extents);
        } else if (shape instanceof CompoundShape) {
            CompoundShape compound = (CompoundShape) shape;
            CompoundShape newShape = new CompoundShape();
            for (CompoundShapeChild child : compound.getChildList()) {
                CollisionShape rotatedChild = rotate(child.childShape, rot);
                Vector3f offset = QuaternionUtil.quatRotate(rot, child.transform.origin, new Vector3f());
                newShape.addChildShape(new Transform(new Matrix4f(Rotation.none().getQuat4f(), offset, 1.0f)), rotatedChild);
            }
            return newShape;
        } else if (shape instanceof ConvexHullShape) {
            ConvexHullShape convexHull = (ConvexHullShape) shape;
            ObjectArrayList<Vector3f> transformedVerts = new ObjectArrayList<>();
View Full Code Here

TOP

Related Classes of com.bulletphysics.collision.shapes.CompoundShape

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.