ActiveCrawl
A class in Root.Township, Alta.Intelligence.
Server: running action that makes a creature crawl over any surface (walls, ceilings) by moving its transform along raycast hits, turning at random. Settings come from AgentCrawlSettings.
- Listed in Creatures and AI
- Inherits or implements
BasicActiveAction<Agent, AgentCrawlSettings> - Documented in Actions and decisions
Constructors
| Member | What it is |
|---|---|
ActiveCrawl() | Creates an ActiveCrawl with default values. |
Fields
12 private and internal fields
| Member | What it is |
|---|---|
private float beganFacingWall | Time the creature started facing the current wall. |
private Quaternion currentRotation | The crawl rotation, aligned with the surface it's on. |
private int frameCount | Frames since the last raycast check. |
private Color hitColor | Debug colour for the kind of surface hit last. Not drawn anywhere in this build. |
private bool isFacingWall | Whether the creature is blocked by something ahead. |
private Vector3 lastHit | The last surface point the creature was moved to. |
private float maxTimeFacingWall | Seconds the creature stays facing a wall before picking a new heading. 2. |
private Vector3 targetWalkDirection | The heading the creature is turning towards. |
private Transform transform | The creature's rigidbody transform, moved directly. |
private IUnityUpdateMethod update | The registered Walk update. |
private static UpdateModule updateModule | Shared "Crawler Helper" update module that runs Walk. |
private Vector3 walkDirection | The current walking direction. |
Methods
4 private and internal methods
| Member | What it is |
|---|---|
private void CancelAction(IActiveAction finished) | Deregisters the crawl update when the action ends. |
private void GetNewWalkDirection() | Picks a new heading up to 90 degrees either side, or further when facing a wall. |
private void MoveTo(Vector3 point, Vector3 normal) | Puts the creature at a surface point and turns it towards the surface normal and walk direction. |
private void Walk() | Per frame: moves forward and steers to the heading. Every few frames raycasts to follow surfaces, turn at walls, or switch to the recover-from-falling set. |