AIBase:RaycastPosition bug?


So RaycastPosition uses same ray length as offset from AI position, and due to Mathf.Max(0, lastElevation-elevation); it gets ray hit. But if you set unity timescale = 0, then delta will be zero and rayhit will not reach surface. Why not raycast a bit futher, lets say 0.1 unit more to prevent this from happening?



If the time scale is zero then the character shouldn’t really be moving at all. So not moving it seems like a good solution in this case imo.

Yes, it’s not moving and it’s totally fine. But it gets null in ray trace, and for example we are using ray trace to define surface type of an agent, and surface type is then used in different places in AI code. Someone might use ray trace result in game logic too.

Just saying that it will work ok with extended a bit ray or maybe use last ray trace result if delta time is zero


Then this is not an issue with the AIBase script itself. The raycast in only used internally and it isn’t exposed by default. If you want full control over how the raycast works I’d recommend that you use your own raycast.