Support Forum

CharacterController Plus RichAI Move()


I have an AI that can switch between point-click (set via RichAI destination value) and WASD movement (using the Move() function). I’m using a recast graph.

I can move the AI using either successfully – however, if I switch from point-click → WASD movement the character speeds up really quickly and zooms around the map and no longer functions correctly. If I switch back from WASD → point-click the movement is correct.

Interestingly, if I switch between point-click → WASD without giving a point-click direction then it works perfectly! I have tried disabling and re-enabling the RichAI incase resetting the values fixed it. Any other ideas?

*the character speeds up really quickly = The _ai.velocity value increases substantially too


The Move function is not really intended for that.
I would instead recommend just setting the destination of the agent to the agent’s position + some small offset (e.g. 2 meters) in the direction specified by the WASD keys. That will also have the benefit that the agent will automatically move around small obstacles even when using WASD.