lethexa-motionpredict.js
function(myPos, myVelo, targetPos, targetVelo ) {
    var distance = Math.sqrt(mf.lengthSquared(mf.sub(targetPos, myPos)));
    var approachSpeed = this.calcApproachSpeed(myPos, myVelo, targetPos, targetVelo);
    if( approachSpeed > 0.0 ) {
      return distance / approachSpeed;
    }
    else {
      return undefined;
    }
  }
function(myPos, myVelo, targetPos, targetVelo ) {
    var distance = Math.sqrt(mf.lengthSquared(mf.sub(targetPos, myPos)));
    var approachSpeed = this.calcApproachSpeed(myPos, myVelo, targetPos, targetVelo);
    if( approachSpeed > 0.0 ) {
      return distance / approachSpeed;
    }
    else {
      return undefined;
    }
  }
function ( myPos , myVelo , targetPos , targetVelo ) { var distance = Math . sqrt ( mf . lengthSquared ( mf . sub ( targetPos , myPos ) ) ) ; var approachSpeed = this . calcApproachSpeed ( myPos , myVelo , targetPos , targetVelo ) ; if ( approachSpeed > 0.0 ) { return distance / approachSpeed ; } else { return undefined ; } }
Calculates the arrivaltime of the target to my position.
@method calcArrivalTime
@param myPos {Vector3d} The position of me.
@param myVelo {Vector3d} The velocity of me.
@param targetPos {Vector3d} The position of the target.
@param targetVelo {Vector3d} The velocity and direction in which the target is moving.
@return {Number} The time in which the target has reached me or undefined if not reachable.
@for motionpredict
Calculates the arrivaltime of the target to my position .