Package graphics.common

Examples of graphics.common.Velocity


    @Override
    public void applyTo( Effectable e, double delta ) {
        EffectData data = e.getData();
        if( data.isVelocitySupported() ) {
            Velocity vel = data.getCurVelocity();
            double modifier = mTime / delta;
            double deltaDecay = mShouldApplyDecay ? mDeltaDecayRate : 1.0;
            mVelDelta.modify( mVelDelta.getXPart() * modifier * deltaDecay,
                    mVelDelta.getYPart() * modifier * deltaDecay,
                    mVelDelta.getZPart() * modifier * deltaDecay );
            vel.modify( mVelDelta.getXPart(), mVelDelta.getYPart(), mVelDelta.getZPart() );

            // Make sure the modified velocity does not go below/above a certain amount
            // so that something doesn't either reverse velocity, or slow down
            // so much that it does not actually get to where it needs to go.

            //TODO: Fix this so it works with both negative and positive velocities.
            // currently it only works with positive, as minimumspeed will always
            // be a positive value.

            if( vel.getRealXVelocity() < mMinimumSpeed.getXPart() ) {
                vel.setXVelocity( mMinimumSpeed.getXPart() );
            }
            if( vel.getRealYVelocity() < mMinimumSpeed.getYPart() ) {
                vel.setYVelocity( mMinimumSpeed.getYPart() );
            }
            if( vel.getRealZVelocity() < mMinimumSpeed.getZPart() ) {
                vel.setZVelocity( mMinimumSpeed.getZPart() );
            }
           
            vel = null;
        }
        data = null;
View Full Code Here

TOP

Related Classes of graphics.common.Velocity

Copyright © 2018 www.massapicom. 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.