Examples of PhysicsJoint


Examples of com.jme3.bullet.joints.PhysicsJoint

        HashMap<PhysicsJoint, Spatial> oldObjects = joints;
        joints = new HashMap<PhysicsJoint, Spatial>();
        Collection<PhysicsJoint> current = space.getJointList();
        //create new map
        for (Iterator<PhysicsJoint> it = current.iterator(); it.hasNext();) {
            PhysicsJoint physicsObject = it.next();
            //copy existing spatials
            if (oldObjects.containsKey(physicsObject)) {
                Spatial spat = oldObjects.get(physicsObject);
                joints.put(physicsObject, spat);
                oldObjects.remove(physicsObject);
            } else {
                if (filter == null || filter.displayObject(physicsObject)) {
                    logger.log(Level.FINE, "Create new debug Joint");
                    //create new spatial
                    Node node = new Node(physicsObject.toString());
                    node.addControl(new BulletJointDebugControl(this, physicsObject));
                    joints.put(physicsObject, node);
                    physicsDebugRootNode.attachChild(node);
                }
            }
        }
        //remove leftover spatials
        for (Map.Entry<PhysicsJoint, Spatial> entry : oldObjects.entrySet()) {
            PhysicsJoint object = entry.getKey();
            Spatial spatial = entry.getValue();
            spatial.removeFromParent();
        }
    }
View Full Code Here

Examples of com.jme3.bullet.joints.PhysicsJoint

            RigidBodyControl physicsNode = spatial.getControl(RigidBodyControl.class);
            physicsNode.setPhysicsSpace(this);
            //add joints
            List<PhysicsJoint> joints = physicsNode.getJoints();
            for (Iterator<PhysicsJoint> it1 = joints.iterator(); it1.hasNext();) {
                PhysicsJoint physicsJoint = it1.next();
                //add connected physicsnodes if they are not already added
                if (physicsJoint.getBodyA() instanceof PhysicsControl) {
                    add(physicsJoint.getBodyA());
                } else {
                    addRigidBody(physicsJoint.getBodyA());
                }
                if (physicsJoint.getBodyA() instanceof PhysicsControl) {
                    add(physicsJoint.getBodyB());
                } else {
                    addRigidBody(physicsJoint.getBodyB());
                }
                addJoint(physicsJoint);
            }
        } else if (spatial.getControl(PhysicsControl.class) != null) {
            spatial.getControl(PhysicsControl.class).setPhysicsSpace(this);
View Full Code Here

Examples of com.jme3.bullet.joints.PhysicsJoint

            RigidBodyControl physicsNode = spatial.getControl(RigidBodyControl.class);
            physicsNode.setPhysicsSpace(null);
            //remove joints
            List<PhysicsJoint> joints = physicsNode.getJoints();
            for (Iterator<PhysicsJoint> it1 = joints.iterator(); it1.hasNext();) {
                PhysicsJoint physicsJoint = it1.next();
                //add connected physicsnodes if they are not already added
                if (physicsJoint.getBodyA() instanceof PhysicsControl) {
                    remove(physicsJoint.getBodyA());
                } else {
                    removeRigidBody(physicsJoint.getBodyA());
                }
                if (physicsJoint.getBodyA() instanceof PhysicsControl) {
                    remove(physicsJoint.getBodyB());
                } else {
                    removeRigidBody(physicsJoint.getBodyB());
                }
                removeJoint(physicsJoint);
            }
        } else if (spatial.getControl(PhysicsControl.class) != null) {
            spatial.getControl(PhysicsControl.class).setPhysicsSpace(null);
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.