Examples of CollisionShape


Examples of com.bulletphysics.collision.shapes.CollisionShape

        // can use a shift
        startTransform.setIdentity();
        startTransform.origin.set(0, 0, -10f);
       
        // this create an internal copy of the vertices
        CollisionShape shape = new ConvexHullShape(vertices);
        collisionShapes.add(shape);

        //btRigidBody* body = m_demoApp->localCreateRigidBody(mass, startTransform,shape);
        localCreateRigidBody(mass, startTransform, shape);
      }
View Full Code Here

Examples of com.bulletphysics.collision.shapes.CollisionShape

    protected void onDispose() {
    }

    public CollisionShape getCollisionShape(Rotation rot) {
        Rotation simplifiedRot = applySymmetry(rot);
        CollisionShape result = collisionShape.get(simplifiedRot);
        if (result == null && baseCollisionShape != null) {
            result = rotate(baseCollisionShape, simplifiedRot.getQuat4f());
            collisionShape.put(simplifiedRot, result);
        }
        return result;
View Full Code Here

Examples of com.bulletphysics.collision.shapes.CollisionShape

            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) {
View Full Code Here

Examples of com.jme3.bullet.collision.shapes.CollisionShape

        rootNode.attachChild(island);

        // Load Island CollisionMesh
        Node islandCollision = (Node) assetManager.loadModel("Models/Islands/ogre/island_01_collision.j3o");
        Geometry geoCollision = (Geometry) islandCollision.getChild(0);
        CollisionShape colShape = new MeshCollisionShape(geoCollision.getMesh());
        colShape.setMargin(0.005f);
        RigidBodyControl rigControl = new RigidBodyControl(colShape, 0);
        island.addControl(rigControl);
        bulletAppState.getPhysicsSpace().add(rigControl);

View Full Code Here

Examples of com.jme3.bullet.collision.shapes.CollisionShape

    @Override
    public void read(JmeImporter e) throws IOException {
        InputCapsule capsule = e.getCapsule(this);
        collisionGroup = capsule.readInt("collisionGroup", 0x00000001);
        collisionGroupsMask = capsule.readInt("collisionGroupsMask", 0x00000001);
        CollisionShape shape = (CollisionShape) capsule.readSavable("collisionShape", null);
        collisionShape = shape;
    }
View Full Code Here

Examples of com.jme3.bullet.collision.shapes.CollisionShape

            CompoundCollisionShape shape = (CompoundCollisionShape) collisionShape;
            List<ChildCollisionShape> children = shape.getChildren();
            Node node = new Node("DebugShapeNode");
            for (Iterator<ChildCollisionShape> it = children.iterator(); it.hasNext();) {
                ChildCollisionShape childCollisionShape = it.next();
                CollisionShape ccollisionShape = childCollisionShape.shape;
                Geometry geometry = createDebugShape(ccollisionShape);

                // apply translation
                geometry.setLocalTranslation(childCollisionShape.location);
View Full Code Here

Examples of com.jme3.bullet.collision.shapes.CollisionShape

    sceneModel = assetManager.loadModel("main.scene");
    sceneModel.setLocalScale(2f);

    // We set up collision detection for the scene by creating a
    // compound collision shape and a static RigidBodyControl with mass zero.
    CollisionShape sceneShape = CollisionShapeFactory.createMeshShape(sceneModel);
    landscape = new RigidBodyControl(sceneShape, 0);
    sceneModel.addControl(landscape);

    // We set up collision detection for the player by creating
    // a capsule collision shape and a CharacterControl.
View Full Code Here

Examples of com.jme3.bullet.collision.shapes.CollisionShape

    public void addScene(){
        assetManager.registerLocator("town.zip", ZipLocator.class);
        Spatial underground = assetManager.loadModel("main.scene");
        underground.setLocalScale(2f);
        scene.attachChild(underground);
        CollisionShape sceneShape =
            CollisionShapeFactory.createMeshShape(scene);
        RigidBodyControl landscape;
        landscape = new RigidBodyControl(sceneShape, 0);
        scene.addControl(landscape);
        bulletAppState.getPhysicsSpace().add(scene);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.