Contents
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
Created on 15/07/2020
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T extends BodyMotion>
TfindWrappedBodyMotion(Class<T> clazz) Search for a wrapped body motion of the given type, looking through wrapper body motions such asBodyMotionTimerandBodyMotionSequence.default doubleGet desired target distance from the steering motion.default Ref<EntityStore> Get the desired target entity from the steering motion.default EnumSet<RelaxedConstraint> Returns the set of movement constraints that this body motion has been configured to relax, ornullfor body motions that do not support constraint relaxation.default BodyMotionReturn Motion which actually generated the steering valueMethods inherited from interface IAnnotatedComponent
getBreadCrumbs, getBreadCrumbs, getIndex, getInfo, getLabel, getParent, setContextMethods inherited from interface Motion
activate, computeSteering, deactivate, preComputeSteeringMethods inherited from interface RoleStateChange
loaded, motionControllerChanged, registerWithSupport, removed, spawned, teleported, unloaded
-
Method Details
-
getSteeringMotion
Return Motion which actually generated the steering valueMotions 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
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
Search for a wrapped body motion of the given type, looking through wrapper body motions such asBodyMotionTimerandBodyMotionSequence.The default implementation uses
getSteeringMotion()to unwrap a single level of wrapping, which handles timers correctly at any depth sincegetSteeringMotion()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
nullif none found
-
getRelaxedConstraints
Returns the set of movement constraints that this body motion has been configured to relax, ornullfor body motions that do not support constraint relaxation.- Returns:
- the relaxed constraint set from the motion's configuration, or
nullif not applicable
-