Interface BodyRotationController

All Superinterfaces:
DataIO
All Known Implementing Classes:
DefaultBodyRotationController, EmptyBodyRotationController

public interface BodyRotationController extends DataIO
Wrapper interface for controlling the body rotation of a living entity.

Clarification

Head Angle
This is the clamped angle used when the entity is moving and looking around at the same time. In this case, the body takes the initiative and limit the head angle.

Body Angle
This is the clamped angle used when the entity is standing still and looking around at the same time. In this case, the head takes the initiative and drag the body along.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
     
    float
     
    float
     
    float
     
    int
     
    int
     
    float
     
    float
     
    float
     
    float
     
    boolean
     
    boolean
     
    boolean
     
    default void
     
    default void
     
    void
    setBodyClampUneven(boolean flag)
     
    void
    setHeadClampUneven(boolean flag)
     
    void
    setMaxBodyAngle(float angle)
    If body clamp is even, set the max body angle for both sides.
    Otherwise, only set the angle on the positive side.
    void
    setMaxHeadAngle(float angle)
    If head clamp is even, set the max head angle for both sides.
    Otherwise, only set the angle on the positive side.
    void
    setMinBodyAngle(float angle)
    If body clamp is uneven, set the angle on the negative side.
    Otherwise, this method has no effect.
    void
    setMinHeadAngle(float angle)
    If head clamp is uneven, set the angle on the negative side.
    Otherwise, this method has no effect.
    void
    setPlayerMode(boolean flag)
    Toggle player rotation mode.
    If true, the body would act like the player's body rotation.
    Otherwise, the body would auto rotate to match the head's rotation after a certain period of time.
    void
    setRotationDelay(int delay)
    Set the wait time before the body auto rotates to match the head's rotation.
    For example, if delay = 60, the entity would rotate its head, stop, and wait 3 seconds before rotating its body.
    void
    setRotationDuration(int duration)
    Set the time it takes to auto rotates back to the head's rotation.
    For example, if duration = 60, the entity would rotate its head, stop, wait 0.5 second, and takes 3 seconds to match body rotation to the head rotation.
    void
    setStableAngle(float angle)
    Set the stable angle before correcting back to the clamped angle.
    For example, if the clamp = 50, and the stable angle = 15, the body can be 65 degrees away from the head before snapping back to 50 degrees away.
    This causes the "sudden jerk" effect on all entity body rotation.
    void
    setXHeadRot(float rot)
     
    void
    setYBodyRot(float rot)
     
    void
    setYHeadRot(float rot)
     
    default void
    Update method that is called every tick only if the entity does not have a body rotation controller by default.

    Methods inherited from interface com.ticxo.modelengine.api.utils.data.io.DataIO

    save
  • Method Details

    • tick

      default void tick()
      Update method that is called every tick only if the entity does not have a body rotation controller by default.
    • getYHeadRot

      float getYHeadRot()
    • setYHeadRot

      void setYHeadRot(float rot)
    • getXHeadRot

      float getXHeadRot()
    • setXHeadRot

      void setXHeadRot(float rot)
    • getYBodyRot

      float getYBodyRot()
    • setYBodyRot

      void setYBodyRot(float rot)
    • isHeadClampUneven

      boolean isHeadClampUneven()
    • setHeadClampUneven

      void setHeadClampUneven(boolean flag)
    • isBodyClampUneven

      boolean isBodyClampUneven()
    • setBodyClampUneven

      void setBodyClampUneven(boolean flag)
    • getMaxHeadAngle

      float getMaxHeadAngle()
    • setMaxHeadAngle

      void setMaxHeadAngle(float angle)
      If head clamp is even, set the max head angle for both sides.
      Otherwise, only set the angle on the positive side.
      Parameters:
      angle - angle in degrees
    • getMaxBodyAngle

      float getMaxBodyAngle()
    • setMaxBodyAngle

      void setMaxBodyAngle(float angle)
      If body clamp is even, set the max body angle for both sides.
      Otherwise, only set the angle on the positive side.
      Parameters:
      angle - angle in degrees
    • getMinHeadAngle

      float getMinHeadAngle()
    • setMinHeadAngle

      void setMinHeadAngle(float angle)
      If head clamp is uneven, set the angle on the negative side.
      Otherwise, this method has no effect.
      Parameters:
      angle - angle in degrees
    • getMinBodyAngle

      float getMinBodyAngle()
    • setMinBodyAngle

      void setMinBodyAngle(float angle)
      If body clamp is uneven, set the angle on the negative side.
      Otherwise, this method has no effect.
      Parameters:
      angle - angle in degrees
    • getStableAngle

      float getStableAngle()
    • setStableAngle

      void setStableAngle(float angle)
      Set the stable angle before correcting back to the clamped angle.
      For example, if the clamp = 50, and the stable angle = 15, the body can be 65 degrees away from the head before snapping back to 50 degrees away.
      This causes the "sudden jerk" effect on all entity body rotation.
      Parameters:
      angle - angle in degrees
    • isPlayerMode

      boolean isPlayerMode()
    • setPlayerMode

      void setPlayerMode(boolean flag)
      Toggle player rotation mode.
      If true, the body would act like the player's body rotation.
      Otherwise, the body would auto rotate to match the head's rotation after a certain period of time.
    • getRotationDelay

      int getRotationDelay()
    • setRotationDelay

      void setRotationDelay(int delay)
      Set the wait time before the body auto rotates to match the head's rotation.
      For example, if delay = 60, the entity would rotate its head, stop, and wait 3 seconds before rotating its body.
      Parameters:
      delay - delay in ticks
    • getRotationDuration

      int getRotationDuration()
    • setRotationDuration

      void setRotationDuration(int duration)
      Set the time it takes to auto rotates back to the head's rotation.
      For example, if duration = 60, the entity would rotate its head, stop, wait 0.5 second, and takes 3 seconds to match body rotation to the head rotation.
      Parameters:
      duration - duration in ticks.
    • save

      default void save(SavedData data)
      Specified by:
      save in interface DataIO
    • load

      default void load(SavedData data)
      Specified by:
      load in interface DataIO