MinieExamples/src/main/java/jme3utilities/minie/test/BalanceDemo.java
/**
     * Initialization that takes place once all links are ready for dynamic
     * mode.
     */
Initialization that takes place once all links are ready for dynamic
mode.
Initialization that takes place once all links are ready for dynamic mode .
private void initWhenReady() {
        Biped biped = (Biped) dac;
        BoneLink leftFoot = biped.getLeftFoot();
        BoneLink rightFoot = biped.getRightFoot();
        /*
         * Pin the left foot to the ground.
         */
        dac.setDynamicChain(leftFoot, 9, Vector3f.ZERO, false);
        Vector3f[] leftSole = leftFoot.footprint();
        for (Vector3f location : leftSole) {
            dac.pinToWorld(leftFoot, location);
        }
        /*
         * Pin the right foot to the ground.
         */
        dac.setDynamicChain(rightFoot, 9, Vector3f.ZERO, false);
        Vector3f[] rightSole = rightFoot.footprint();
        for (Vector3f location : rightSole) {
            dac.pinToWorld(rightFoot, location);
        }
        /*
         * Apply a BalanceController to the torso.
         */
        Vector3f acc = new Vector3f(0f, vaBias + vaSign * vaMagnitude, 0f);
        torso.setDynamic(acc);
        leftSupportLocation = MyArray.mean(leftSole, null);
        rightSupportLocation = MyArray.mean(rightSole, null);
        Vector3f supportLocation = MyVector3f.lerp(rightSupportFraction,
                leftSupportLocation, rightSupportLocation, null);
        balance = new BalanceController(torso, supportLocation);
        torso.addIKController(balance);
        /*
         * Apply an UprightController to the torso.
         */
        UprightController upright
                = new UprightController(torso, torsoUpDirection);
        torso.addIKController(upright);
        upright.setDeltaGainFactor(uprightGain);
        upright.setErrorGainFactor(uprightGain);
        /*
         * Start playing a canned animation.
         */
        composer.setCurrentAction(animationName);
    }
private void initWhenReady ( ) { Biped biped = ( Biped ) dac ; BoneLink leftFoot = biped . getLeftFoot ( ) ; BoneLink rightFoot = biped . getRightFoot ( ) ; /*
         * Pin the left foot to the ground.
         */ dac . setDynamicChain ( leftFoot , 9 , Vector3f . ZERO , false ) ; Vector3f [ ] leftSole = leftFoot . footprint ( ) ; for ( Vector3f location : leftSole ) { dac . pinToWorld ( leftFoot , location ) ; } /*
         * Pin the right foot to the ground.
         */ dac . setDynamicChain ( rightFoot , 9 , Vector3f . ZERO , false ) ; Vector3f [ ] rightSole = rightFoot . footprint ( ) ; for ( Vector3f location : rightSole ) { dac . pinToWorld ( rightFoot , location ) ; } /*
         * Apply a BalanceController to the torso.
         */ Vector3f acc = new Vector3f ( 0f , vaBias + vaSign * vaMagnitude , 0f ) ; torso . setDynamic ( acc ) ; leftSupportLocation = MyArray . mean ( leftSole , null ) ; rightSupportLocation = MyArray . mean ( rightSole , null ) ; Vector3f supportLocation = MyVector3f . lerp ( rightSupportFraction , leftSupportLocation , rightSupportLocation , null ) ; balance = new BalanceController ( torso , supportLocation ) ; torso . addIKController ( balance ) ; /*
         * Apply an UprightController to the torso.
         */ UprightController upright = new UprightController ( torso , torsoUpDirection ) ; torso . addIKController ( upright ) ; upright . setDeltaGainFactor ( uprightGain ) ; upright . setErrorGainFactor ( uprightGain ) ; /*
         * Start playing a canned animation.
         */ composer . setCurrentAction ( animationName ) ; }
Initialization that takes place once all links are ready for dynamic
 mode.
Initialization that takes place once all links are ready for dynamic mode .