How to have collision on human characterAI?

I’m using RichAI and Recast Graph on my terrain for character movement.

The problem I have is how to have collision on character and to stop the player from moving AI around.

I tried:

–Putting a rigidbody with gravity and a capsule collider but it would fall over constantly even if I put the mass to maximum plus player character and others can push it around which is not good even when messing with physics layers

–Putting a character controller and isKinematic but the problem with that is that, collision does work and player cannot move around the AI but RichAI won’t INNITIALLY move the character at all if it’s enabled. I tried putting in the system that would enable/disable but it leads to errors since it cannot recalculate. Once RichAI calculates the path and starts moving forward and then I enable CharacterController it won’t be able to move away from initial direction but collision does work nicely and I cannot push the character around

So how do I have a moving character that cannot be pushed around the player that also does not go through colliders? Is there some way for RichAI to work with character controller or something like that? I really cannot go without character collision in my game since it might bump into other players while chasing it’s target player. I tried a lot of combinations, character controller on/off, rigidbody, nothing, collider and so on…

Also should I switch from recast graph and richAI to something else?

Thanks in advance for any advice

Hi,
I think you should achieve collision on your AI character while preventing it from being pushed around by the player, you can try the following these steps

  1. RigidBody Configuration:
  • Use a Rigidbody with constraints to prevent rotation and limit movement to the necessary axes.
  • Set the Rigidbody’s “Interpolation” to “Interpolate” and “Collision Detection” to “Continuous” for smoother interactions.
  1. CharacterController and RichAI Integration:
  • Use a CharacterController for collision detection and attach it to your AI character.
  • Modify the RichAI script to work with the CharacterController by disabling the CharacterController when calculating the path and enabling it during movement.
    Thanks

You’d need to lock the rotation of the rigidbody.

You should never use a rigidbody and a CharacterController in Unity. Use one or the other, but not both.

I would think that just attaching a CharacterController (without a rigidbody) would work.

You may also be interested in this tutorial: Manual Player Movement - A* Pathfinding Project