コード例 #1
0
  @Override
  public void update(float time) {

    // Update for current speed
    accelerationSpring.update(desiredSpeedForThrottle(), time);
    currentSpeed = accelerationSpring.getPosition();

    // s.moveLocal(2, currentSpeed * time);

    // Work out desired velocity, as target for decay
    NodeTranslator.makeTranslationVector(
        s.getRotation(), 2, currentSpeed, velocityDecay.getTarget());

    // Decay velocity towards desired
    velocityDecay.update(time);

    // Make the move
    move.set(velocityDecay.getPosition());
    move.multLocal(time);
    s.moveGlobal(move);
  }
コード例 #2
0
 /** @return Current velocity according to this throttle controller */
 public Vector3f getVelocity() {
   return velocityDecay.getPosition();
 }