Class RotateToAction

  • All Implemented Interfaces:
    Pool.Poolable

    public class RotateToAction
    extends TemporalAction
    Sets the actor's rotation from its current value to a specific value. By default, the rotation will take you from the starting value to the specified value via simple subtraction. For example, setting the start at 350 and the target at 10 will result in 340 degrees of movement. If the action is instead set to useShortestDirection instead, it will rotate straight to the target angle, regardless of where the angle starts and stops. For example, starting at 350 and rotating to 10 will cause 20 degrees of rotation.
    See Also:
    MathUtils.lerpAngleDeg(float, float, float)
    • Constructor Detail

      • RotateToAction

        public RotateToAction()
      • RotateToAction

        public RotateToAction​(boolean useShortestDirection)
        Parameters:
        useShortestDirection - Set to true to move directly to the closest angle
    • Method Detail

      • update

        protected void update​(float percent)
        Description copied from class: TemporalAction
        Called each frame.
        Specified by:
        update in class TemporalAction
        Parameters:
        percent - The percentage of completion for this action, growing from 0 to 1 over the duration. If reversed, this will shrink from 1 to 0.
      • getRotation

        public float getRotation()
      • setRotation

        public void setRotation​(float rotation)
      • isUseShortestDirection

        public boolean isUseShortestDirection()
      • setUseShortestDirection

        public void setUseShortestDirection​(boolean useShortestDirection)