Class BodyMotionMaintainDistance

All Implemented Interfaces:
BodyMotion, Motion, RoleStateChange, IAnnotatedComponent

public class BodyMotionMaintainDistance extends BodyMotionBase
  • Constructor Details

  • Method Details

    • computeSteering

      public boolean computeSteering(@Nonnull Ref<EntityStore> ref, @Nonnull ExecutionSupport executionSupport, @Nullable InfoProvider sensorInfo, double dt, @Nonnull Steering desiredSteering, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Description copied from interface: Motion
      Calculate desired steering for MotionController.
      Parameters:
      ref - The entity ref
      executionSupport - The ExecutionSupport
      sensorInfo - SensorInfo with PositionProvider, PathProvider, etc. if required
      dt - The interval in seconds for this calculation
      desiredSteering - The computed steering force for the MotionController
      componentAccessor - The entity store
      Returns:
      false when the end condition has been reached, true if must be called again to reach end condition or is infinite.
    • deactivate

      public void deactivate(@Nonnull Ref<EntityStore> ref, @Nonnull ExecutionSupport executionSupport, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Description copied from interface: Motion
      Called to deactivate this motion
      Parameters:
      ref - The entity ref
      executionSupport - The ExecutionSupport
      componentAccessor - The component store for component access
    • getDesiredTargetDistance

      public double getDesiredTargetDistance()
      Description copied from interface: BodyMotion
      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 public Ref<EntityStore> getDesiredTargetEntity()
      Description copied from interface: BodyMotion
      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.