Hello I’m using custom physics for my 2D game, and would like to use the RVO feature as a standalone.
I added the RVO Controller+ Simulator/Navmesh as in the example, but i’m having trouble getting the movedir with Local Avoidance taken in account…
so far I’m using something like this to set my velocity.
Would expect seeker.StartPath() to take RVO in account but it isn’t.
tried to modify the AIPath a little to see where I could go but no luck after hours.
Basically I just want to simulate the RVO’s path without doing any position updates,
as there’s a lot of custom physics that add to my AI’s movement.
please let me know if there’s any way to get THE DIRECTION OF WHICH THE RVO AGENT WOULD MOVE, BUT WITHOUT MOVING
The Seeker doesn’t care about RVO at all. The seeker only communicates with the pathfinding system, and pathfinding is completely separate from local avoidance.
If you have a RVOController attached you can get the offset it wants to move in a single frame using rvoController.CalculateMovementDelta(Time.deltaTime). Or you can get the velocity using rvoController.velocity.
Note that RVO will work worse if it doesn’t actually move as the local avoidance system thinks it will move. It will still work, but since it cannot as well predict how units are going to move, the avoidance quality may be lower.
The RVOController doesn’t do any movement itself, it only returns which direction it wants to move. Typically the AIPath script does the actual movement (or whatever other movement script you are using).
Thanks for your answer! I got this down and working.However, is there any reason the code above should be generating a ton of garbage each frame?
I tried it with the AIPath script(which doesn’t work for me as I don’t want the movement to be final) but it creates WAY less garbage, and not every frame.