How to make AIPath movement direction follow rotation instead of using full velocity vector? (Vehicle/Tank movement)

Hello,

I am using the A* Pathfinding Project with Unity for an RTS game.

Currently, I am using AIPath for unit movement. The pathfinding, acceleration, deceleration, and avoidance features work very well, so I would like to keep using AIPath instead of replacing the whole movement system.

However, I have a problem with vehicle-like units (for example tanks).

The default AIPath movement seems to work like this:

  • The agent calculates a desired velocity vector.

  • The transform position is moved directly according to this velocity vector.

  • Rotation is handled separately.

Because of this, the unit can move sideways while its forward direction is different from the movement direction.

Example:


Tank forward direction:
        ↑

Actual movement:
        ↗

The result looks like the tank is sliding/drifting.

For a tank or vehicle, I would like the movement model to be:

  1. AIPath calculates the path and provides the next steering target.

  2. The unit rotates towards the target direction.

  3. Acceleration/deceleration controls a scalar speed value.

  4. The final movement direction is always transform.forward.

Something like:


desired direction = AIPath steering target

rotation = rotate towards desired direction

speed = accelerate/decelerate

velocity = transform.forward * speed

Is there a recommended way to achieve this while keeping AIPath’s:

  • path calculation

  • acceleration

  • slowdown distance

  • local avoidance (RVO if possible)

?

Should I:

  1. Override some AIPath methods such as MovementUpdateInternal()?

  2. Implement a custom IAstarAI movement controller?

  3. Use AIPath only for path following and write my own movement update?

  4. Is there already a built-in option for vehicle-style movement?

I would like to avoid disabling AIPath completely because its acceleration and stopping behaviour are very useful.

Thank you!

I was able to get something decently convincing just changing a few settings:

  • Rotation Speed: 180
  • Slow When Not Facing Target: true
  • Prevent Moving Backwards: true

If this isn’t the movement you’re looking for, the options you already named work well:

I think the third is the easiest but these are all valid ideas.

To the best of my knowledge no.