Function RichAI.Teleport
Instantly move the agent to a new position.
void Teleport (
newPosition | ||
bool | clearPath=true |
Instantly move the agent to a new position.
This will trigger a path recalculation (if clearPath is true, which is the default) so if you want to teleport the agent and change its destination it is recommended that you set the destination before calling this method.
The current path will be cleared by default.
This method is preferred for long distance teleports. If you only move the agent a very small distance (so that it is reasonable that it can keep its current path), then setting the position property is preferred. When using the FollowerEntity movement script, setting the position property when using a long distance teleport could cause the agent to fail to move the full distance, as it can get blocked by the navmesh.
When setting transform.position directly the agent will be clamped to the part of the navmesh it can reach, so it may not end up where you wanted it to. This ensures that the agent can move to any part of the navmesh.