m_velocity2D and its use in RichAI

Hey team! Another dumb question here that I’ll probably solve right after I post!

I’m currently refactoring some of RichAI into a new class, though I am keeping RichAI intact for understanding’s sake.

Is the intention in RichAI that m_velocity2D, which seems to drive the movement in FinalizeMovement, only be incremented and set in the TraverseFunnel function?

Currently, my code never hits that since currentPart in MovementUpdateInternal is always null. Any thoughts? What dumb thing am I missing with my agents?


currentPart being null seems like a bad thing. The ‘currentPart’ field is the part of path that the agent is currently following (a path is divided into several parts, where each part is either an off mesh link or a sequence of nodes on the navmesh).

1 Like

So in debugging, I noticed a couple of things. First, thanks for taking the time to reply! Sorry for all the questions recently!

I noticed that OnPathComplete was invoked by the AStarPath component in the scene rather than by Seeker. OnPathComplete actually did the work to set the RichPath, which gave me a non-null currentPart.

Couple of questions that arose from this for me:

  • TraverseFunnel correctly found a reasonable target velocity, but it seems that the value is discarded as we go into FinalMovement. Why is that? The CalculateDeltaToMoveThisFrame call is always returning a 0,0 delta for me, which the other code seems to grok.
  • Where did you intend for RichAI to actively move the character?

Again, thank you so much. EDIT: I love the library, I just need to do some port work for my specific use case, so I’m really trying to understand the internals to see what functionality I need to write (looks like very little).


CalculateDeltaToMoveThisFrame should return velocity2D clamped to some value unless an RVOController component is attached. So if your code managed to calculate a reasonable velocity2D then the CalculateDeltaToMoveThisFrame method should return a reasonable value too.

The character is actually moved in the AIBase.FinalizeMovement method (not FinalMovement, unintended almost name collision there).

Hi there,

Yes, I realized that FinalizeMovement did the assignment, but FinalMovement calculated the actual movement. I have an RVOController attached as well since I intend to use local avoidance for a lot of the pushing issues my characters will have. Is there some gotcha in configuring that that might conflict with the velocity2D?

I’ll keep debugging.

Honestly I’m not quite sure why you need to debug so much. The scripts should work out of the box from the start.
It’s really hard for me to say which part is going wrong when you using only some parts of the script.

1 Like

I can discuss it more via email maybe, but I have to do more work with your library than I’d like because of external reasons.

Please do not take my tearing it apart and debugging as a sign of it not being excellent. I am very impressed by the library and its features.

Ok. You can send me a PM instead.

Huh, I must be laughably inept. How do I PM you from the forums?

Click on my name and then click on ‘message’.

Yeah lol, that isn’t a thing on my screen. Welp. I’ll keep digging. Hopefully I’ll surprise you with a message if i figure it out.

Oh, maybe it’s a new user thing. I’ll send you a PM.