Interface BodyMotion

All Superinterfaces:
IAnnotatedComponent, Motion, RoleStateChange
All Known Implementing Classes:
BodyMotionAimCharge, BodyMotionBase, BodyMotionCharge, BodyMotionFind, BodyMotionFindBase, BodyMotionFindWithTarget, BodyMotionFlock, BodyMotionLand, BodyMotionLeave, BodyMotionMaintainDistance, BodyMotionMatchLook, BodyMotionMoveAway, BodyMotionNothing, BodyMotionPath, BodyMotionSequence, BodyMotionTakeOff, BodyMotionTeleport, BodyMotionTestProbe, BodyMotionTimer, BodyMotionWander, BodyMotionWanderBase, BodyMotionWanderInCircle, BodyMotionWanderInRect

public interface BodyMotion extends Motion
Created on 15/07/2020
  • Method Details

    • getSteeringMotion

      @Nullable default BodyMotion getSteeringMotion()
      Return Motion which actually generated the steering value

      Motions can be wrappers around other motions (like MotionTimer). This method returns the actually executed motion generating the steering value in #computeSteering.

      Returns:
      Motion generating the steering value
    • getDesiredTargetDistance

      default double getDesiredTargetDistance()
      Get desired target distance from the steering motion.

      Separation ranges can be larger than the desired distance from a target. To ensure that the target can be reached the NPC needs to know the desired target distance when computing separation.

      Returns:
      Desired target distance or a really large value if not applicable.
    • getDesiredTargetEntity

      @Nullable default Ref<EntityStore> getDesiredTargetEntity()
      Get the desired target entity from the steering motion.

      This is required to match the desired target distance with the actual target entity when computing separation.

      Returns:
      Desired target entity or null if not applicable.
    • findWrappedBodyMotion

      @Nullable default <T extends BodyMotion> T findWrappedBodyMotion(@Nonnull Class<T> clazz)
      Search for a wrapped body motion of the given type, looking through wrapper body motions such as BodyMotionTimer and BodyMotionSequence.

      The default implementation uses getSteeringMotion() to unwrap a single level of wrapping, which handles timers correctly at any depth since getSteeringMotion() is recursive. Wrapper types that aggregate multiple motions (e.g. sequences) should override to search their children.

      Parameters:
      clazz - the type to look for
      Returns:
      the first wrapped instance of the given type, or null if none found
    • getRelaxedConstraints

      @Nullable default EnumSet<RelaxedConstraint> getRelaxedConstraints()
      Returns the set of movement constraints that this body motion has been configured to relax, or null for body motions that do not support constraint relaxation.
      Returns:
      the relaxed constraint set from the motion's configuration, or null if not applicable