Struct FollowerEntityProxy Extends IAstarAI

Public

Proxy for a FollowerEntity using pure ECS components.

This struct behaves almost identically to the FollowerEntity MonoBehaviour component, but it wraps an Entity in a given world instead. It is used primarily when you are using subscenes, and therefore cannot use the FollowerEntity component at runtime.

This struct gives you the same high-level API as the FollowerEntity component, but without the overhead of dealing with GameObjects and MonoBehaviours.

Warning

This struct can only be used on the main thread outside of ECS jobs. When accessing ECS components from within jobs, you must use the ECS api directly.

Usage

  1. Create a subscene (see unity entities documentation).

  2. Create an agent GameObject with a FollowerEntity component within that subscene.

  3. At runtime, the GameObject will be automatically converted to an entity.

  4. You can then use the FollowerEntityProxy struct to interact with the entity. var follower = new FollowerEntityProxy(world, entity);
    follower.maxSpeed = 5;
    follower.destination = new Vector3(1, 2, 3);

    if (follower.currentNode.Tag == 1) {
    Debug.Log("The agent is right now traversing nodes with tag 1");
    }

Inner Types

Public Methods

Destroy ()

Destroys the entity and clears the proxy.

FinalizeMovement (nextPosition, nextRotation)

Move the agent.

FollowerEntityProxy (world, entity)
GetRemainingPath (buffer, [partsBuffer], stale)

Fills buffer with the remaining path.

Move (deltaPosition)

Move the agent.

MovementUpdate (deltaTime, nextPosition, nextRotation)

Calculate how the agent will move during this frame.

Recalculate the current path.

SetDestination (destination, facingDirection=…)

Set the position in the world that this agent should move to.

SetPath (path, updateDestinationFromPath=true)

Make the AI follow the specified path.

Teleport (newPosition, clearPath=true)

Instantly move the agent to a new position.

Public Static Methods

Public Variables

autoRepath

Policy for when the agent recalculates its path.

Public
currentNode

Node which the agent is currently traversing.

Public
debugFlags

Enables or disables debug drawing for this agent.

Public
desiredVelocity

Velocity that this agent wants to move with.

Public
desiredVelocityWithoutLocalAvoidance

Velocity that this agent wants to move with before taking local avoidance into account.

Public
destination

Position in the world that this agent should move to.

Public
destinationFacingDirection

Direction the agent will try to face when it reaches the destination.

Public
enableGravity

Enables or disables gravity.

Public
enableLocalAvoidance

True if local avoidance is enabled for this agent.

Public
endOfPath

End point of path the agent is currently following.

Public
entity
Public
entityExists

True if the entity exists.

Public
groundMask

Determines which layers the agent will stand on.

Public
hasPath

True if this agent currently has a valid path that it follows.

Public
height

Height of the agent in world units.

Public
isStopped

Gets or sets if the agent should stop moving.

Public
isTraversingOffMeshLink

True if the agent is currently traversing an off-mesh link.

localAvoidanceTemporarilyDisabled

True if the agent's local avoidance is temporarily disabled, due to traversing an off-mesh link.

Public
maxRotationSpeed

Maximum rotation speed in degrees per second.

Public
maxSpeed

Max speed in world units per second.

Public
movementOverrides

Provides callbacks during various parts of the movement calculations.

Public
movementPlane

The plane the agent is moving in.

Public
movementPlaneSource

How to calculate which direction is "up" for the agent.

Public
movementSettings

Various movement settings.

Public
offMeshLink

The off-mesh link that the agent is currently traversing.

onSearchPath

Called when the agent recalculates its path.

Public
onTraverseOffMeshLink

Callback to be called when an agent starts traversing an off-mesh link.

orientation

Determines which direction the agent moves in.

Public
pathPending

True if a path is currently being calculated.

Public
pathfindingSettings

Pathfinding settings.

Public
position

Position of the agent.

Public
positionSmoothing

How much to smooth the visual position of the agent.

Public
radius

Radius of the agent in world units.

Public
reachedCrowdedEndOfPath

Like reachedEndOfPath, but will also return true if the end of the path is crowded, and this agent has stopped because it cannot get closer.

Public
reachedDestination

True if the ai has reached the destination.

Public
reachedEndOfPath

True if the agent has reached the end of the current path.

Public
remainingDistance

Approximate remaining distance along the current path to the end of the path.

Public
rotation

Rotation of the agent.

Public
rotationSmoothing

How much to smooth the visual rotation of the agent.

Public
rotationSpeed

Desired rotation speed in degrees per second.

Public
rvoSettings

Local avoidance settings.

Public
simulateMovement

Enables or disables movement completely.

Public
steeringTarget

Point on the path which the agent is currently moving towards.

Public
stopDistance

How far away from the destination should the agent aim to stop, in world units.

Public
updatePosition

Determines if the character's position should be coupled to the Transform's position.

Public
updateRotation

Determines if the character's rotation should be coupled to the Transform's rotation.

Public
velocity

Actual velocity that the agent is moving with, including gravity.

Public
world
Public

Public Static Variables

indicesScratch
Public Static
nextCornersScratch
Public Static

Private/Protected Members

ResetControl (resolvedMovement, controlOutput, movementPlane, position, rotation, endOfPath)
ToggleComponent<T> (world, entity, enabled, mustExist)

Adds or removes a component from an entity.

ToggleComponentEnabled<T> (world, entity, enabled, mustExist)

Enables or disables a component on an entity.

agentCylinderShapeAccessRO
Internal Static
agentCylinderShapeAccessRW
Internal Static
agentOffMeshLinkTraversalRO
Internal Static
autoRepathPolicyRW
Internal Static
destinationPointAccessRO
Internal Static
destinationPointAccessRW
Internal Static
entityStorageCache
Internal Static
likelyHasReasonableComponents

True if the entity seems to have the required components.

Internal
localTransformAccessRO
Internal Static
localTransformAccessRW
Internal Static
managedSettingsAccessRO
Internal Static
managedSettingsAccessRW
Internal Static
managedStateAccessRO
Internal Static
managedStateAccessRW
Internal Static
movementControlAccessRO
Internal Static
movementControlAccessRW
Internal Static
movementOutputAccessRW
Internal Static
movementPlaneAccessRO
Internal Static
movementPlaneAccessRW
Internal Static
movementSettingsAccessRO
Internal Static
movementSettingsAccessRW
Internal Static
movementStateAccessRO
Internal Static
movementStateAccessRW
Internal Static
movementStatisticsAccessRO
Internal Static
movementStatisticsAccessRW
Internal Static
readyToTraverseOffMeshLinkRW
Internal Static
resolvedMovementAccessRO
Internal Static
resolvedMovementAccessRW
Internal Static
rvoSettingsAccessRO
Internal Static
rvoSettingsAccessRW
Internal Static

Deprecated Members

canSearch

Enables or disables recalculating the path at regular intervals.

Public