MinieExamples/src/main/java/jme3utilities/minie/test/TestMultiBody.java
/**
     * Add a MultiBody to the scene.
     */
Add a MultiBody to the scene.
Add a MultiBody to the scene .
private void addMultiBody() {
        int numLinks = 1;
        float linkMass = 1f;
        Vector3f inertia = new Vector3f(1f, 1f, 1f);
        boolean fixedBase = false;
        boolean canSleep = false;
        MultiBody multiBody = new MultiBody(numLinks, linkMass, inertia,
                fixedBase, canSleep);
        CollisionShape baseShape = new SphereCollisionShape(0.3f);
        multiBody.addBaseCollider(baseShape);
        MultiBodyLink parent = null;
        boolean disableCollision = false;
        Vector3f offset = new Vector3f(0f, -0.1f, 1f);
        MultiBodyLink link = multiBody.configureSphericalLink(linkMass, inertia,
                parent, Quaternion.IDENTITY, offset, offset, disableCollision);
        CollisionShape linkShape = new BoxCollisionShape(0.3f);
        link.addCollider(linkShape);
        MultiBodySpace space = (MultiBodySpace) getPhysicsSpace();
        space.addMultiBody(multiBody);
    }
private void addMultiBody ( ) { int numLinks = 1 ; float linkMass = 1f ; Vector3f inertia = new Vector3f ( 1f , 1f , 1f ) ; boolean fixedBase = false ; boolean canSleep = false ; MultiBody multiBody = new MultiBody ( numLinks , linkMass , inertia , fixedBase , canSleep ) ; CollisionShape baseShape = new SphereCollisionShape ( 0.3f ) ; multiBody . addBaseCollider ( baseShape ) ; MultiBodyLink parent = null ; boolean disableCollision = false ; Vector3f offset = new Vector3f ( 0f , - 0.1f , 1f ) ; MultiBodyLink link = multiBody . configureSphericalLink ( linkMass , inertia , parent , Quaternion . IDENTITY , offset , offset , disableCollision ) ; CollisionShape linkShape = new BoxCollisionShape ( 0.3f ) ; link . addCollider ( linkShape ) ; MultiBodySpace space = ( MultiBodySpace ) getPhysicsSpace ( ) ; space . addMultiBody ( multiBody ) ; }
Add a MultiBody to the scene.
Add a MultiBody to the scene .