AgentRollUpInPlace
A class in Root.Township, Alta.Intelligence.
Server: running action that turns an upside down or tipped crawler back upright onto the nearest ground surface, then can switch action sets. Settings come from AgentRollUpInPlaceSettings.
- Listed in Creatures and AI
- Inherits or implements
BasicActiveAction<Agent, AgentRollUpInPlaceSettings> - Nested types
Point - Documented in Actions and decisions
Constructors
| Member | What it is |
|---|---|
AgentRollUpInPlace() | Creates an AgentRollUpInPlace with default values. |
Fields
6 private and internal fields
| Member | What it is |
|---|---|
private Transform transform | The creature's rigidbody transform, moved directly. |
private Vector3 turningUpNormal | Normal of the surface the creature is turning onto. |
private Vector3 turningUpPosition | Ground point the creature ends up on. |
private Quaternion turningUpRotation | Upright rotation the creature turns to. |
private IUnityUpdateMethod update | The registered TurnUp update. |
private static UpdateModule updateModule | Shared "Turn up Update" fixed update module. |
Methods
| Member | What it is |
|---|---|
override void Update(bool hasTarget) | Does nothing. The turning runs in TurnUp. |
protected override void OnStart() | Works out the turn and registers TurnUp on its fixed update module. |
6 private and internal methods
| Member | What it is |
|---|---|
private void CalculateTurn() | Finds the nearest ground point and normal around the creature and works out the upright position and rotation to turn to. Falls back to world up. |
private AgentRollUpInPlace.Point GetClosestPoint(Collider collider, Vector3 point, Quaternion rotation) | Gets the closest point on a ground collider. Non-convex mesh colliders are raycast instead, since ClosestPoint doesn't work on them. |
private void OnFinished(IActiveAction active) | Stops the turn update and switches to the ExitTo set if one is set. |
private void TerminateUpdate(IActiveAction finished) | Deregisters the TurnUp update. The overload taking an action is the cancel handler. |
private void TerminateUpdate() | Deregisters the TurnUp update. The overload taking an action is the cancel handler. |
private void TurnUp() | Fixed update: rotates the creature towards the upright rotation, pivoting around the ground contact, and finishes once it's there. |