public void setSpeed(float speedKmh) { float distanceMeters = motionPath.getLength(); float speed = speedKmh / 3.6f; float duration = distanceMeters / speed; motionControl.setInitialDuration(duration); }
public float getSpeed() { float duration = motionControl.getInitialDuration(); float distanceMeters = motionPath.getLength(); float speed = distanceMeters / duration; return 3.6f * speed; }