AIScriptAvoidGaps Class
An AI script object. Causes the entity to turn around if an open space is detected by the ray. Requires a GroundedMovement component, a Position and a FacingDirection component to be present. Doesn't move the entity, just changes the facing direction. Doesn't work if the entity isn't on ground.
Constructor
AIScriptAvoidGaps
-
gapDetectorRightRay
Parameters:
-
gapDetectorRightRay
RayA ray that will be used to detect gaps. The ray should be defined in relation to the position of the entity. The ray is for detecting gaps on the right side, a left variant is calculated automatically. The ray should be defined in a way so that it can't be contained within a world shape, because that will cause the shape to not be detected and thus the entity will turn around. This is especially apparent if you define the beginning of the ray at the "foot" level of an entity and point it straight down, then when climbing a hill, this might cause the hill to not be detected. To avoid this, define the ray beginning at the "head" level, extended slightly to the right and pointing a long way down.
Item Index
Methods
setGapDetectorRightRay
-
gapDetectorRightRay
Parameters:
-
gapDetectorRightRay
RayA ray that will be used to detect gaps. The ray should be defined in relation to the position of the entity. The ray is for detecting gaps on the right side, a left variant is calculated automatically. The ray should be defined in a way so that it can't be contained within a world shape, because that will cause the shape to not be detected and thus the entity will turn around. This is especially apparent if you define the beginning of the ray at the "foot" level of an entity and point it straight down, then when climbing a hill, this might cause the hill to not be detected. To avoid this, define the ray beginning at the "head" level, extended slightly to the right and pointing a long way down.