MinieExamples/src/main/java/jme3utilities/minie/test/BalanceDemo.java
/**
     * Callback invoked once per frame.
     *
     * @param tpf the time interval between frames (in seconds, &ge;0)
     */
Callback invoked once per frame.
@param tpf the time interval between frames (in seconds, ≥0)
Callback invoked once per frame . @param tpf the time interval between frames ( in seconds ≥0 )
@Override
    public void simpleUpdate(float tpf) {
        super.simpleUpdate(tpf);
        comPoint.setEnabled(false);
        supportPoint.setEnabled(false);
        if (dac.isReady()) {
            if (!dacReadyInitDone) {
                initWhenReady();
                dacReadyInitDone = true;
            }
            Vector3f comLocation = new Vector3f();
            dac.centerOfMass(comLocation, null);
            MySpatial.setWorldLocation(comPoint, comLocation);
            comPoint.setEnabled(true);
            if (balance.isEnabled()) {
                Vector3f verticalAcceleration
                        = new Vector3f(0f, vaBias + vaSign * vaMagnitude, 0f);
                torso.setDynamic(verticalAcceleration);
                Vector3f supportLocation = MyVector3f.lerp(rightSupportFraction,
                        leftSupportLocation, rightSupportLocation, null);
                balance.setCenterOfSupport(supportLocation);
                MySpatial.setWorldLocation(supportPoint, supportLocation);
                supportPoint.setEnabled(true);
            }
        }
    }
@ Override public void simpleUpdate ( float tpf ) { super . simpleUpdate ( tpf ) ; comPoint . setEnabled ( false ) ; supportPoint . setEnabled ( false ) ; if ( dac . isReady ( ) ) { if ( ! dacReadyInitDone ) { initWhenReady ( ) ; dacReadyInitDone = true ; } Vector3f comLocation = new Vector3f ( ) ; dac . centerOfMass ( comLocation , null ) ; MySpatial . setWorldLocation ( comPoint , comLocation ) ; comPoint . setEnabled ( true ) ; if ( balance . isEnabled ( ) ) { Vector3f verticalAcceleration = new Vector3f ( 0f , vaBias + vaSign * vaMagnitude , 0f ) ; torso . setDynamic ( verticalAcceleration ) ; Vector3f supportLocation = MyVector3f . lerp ( rightSupportFraction , leftSupportLocation , rightSupportLocation , null ) ; balance . setCenterOfSupport ( supportLocation ) ; MySpatial . setWorldLocation ( supportPoint , supportLocation ) ; supportPoint . setEnabled ( true ) ; } } }
Callback invoked once per frame.
Callback invoked once per frame .