AI Character

Hi, Hope all of you are doing great.
I have an AI car in the scene inherited from the character class. When it moves to some location, some part of its mesh overlaps with the obstacles. I have tried some ways to resolve this issue but it didn’t help. Can someone help me in this regard?
Thanks.

You can have a collision box around the object to prevent it from clipping. I suggest you provide some screenshot or more information about the subject, so that I can help you further! :slight_smile:

1 Like

@EliasWick Please have a look at this
Desktop Screenshot 2023.03.01 - 17.59.21.64

I did use a collision box but still this is happening. I think it’s about Root component and since it is inheriting from Character class that’s Capsule component which is set to 10 size by me. What do you say?

Hey @Adeel_Yaqoob!

It may be that your car is using the capsule component as the basis for any collision. Is there a specific reason why you would not be able to use a pawn, which will most likely work better for your situation?

And as @EliasWick pointed out, it would be best to provide us with screen shots of things like your blueprint, specifically the viewport, for your vehicle as well as any other blueprint or setting that mat be relevant.

Any additional specifics you can provide may go a long way in solving your problem!

A car is not a Character. You should try to use Vehicle instead.
Also, the AIMoveTo functionality in Character is not suitable for a driving vehicle. It will turn in place and do other very un-Vehicle things.

If you absolutely need to use Character, then make the capsule of the character big enough that it encompasses the entire car. You may need to sink the car mesh down from the center of the capsule to make it meet the ground if you do this. Then set the navigation agent radius in your navigation mesh volume to whatever the radius of that capsule is, and re-generate the navmesh.

But, really, you should develop a vehicle AI agent that knows how to turn/steer; that will give you much better behavior in the end.

@Quetzalcodename I have given the box collider the same settings as the Capsule. I’ll provide an SS too. I want to NavMesh to consider box and not capsule.

@jwatte First of all, the chaos vehicle doesn’t use NavMesh and I’ll have to write AI part of code my self so I’m avoiding that by using Character class. Secondly, the car doesn’t look that much like a car since its inheriting from character class but I fine tuned it and it turn something like vehicle. I want the NavMesh to consider Box collider on car for paths and ignore capsule. Anything possible like that?

My advice is: You’re trying to “simplify” but actually making it harder for yourself.

The most straightforward path to an AI vehicle that is robust and works, is to build a vehicle AI controller.

Trying to hack Character to do vehicle movement, isn’t going to be good. The problem is not “the navmesh doesn’t consider the box collision” (although, true, it doesn’t,) but instead “the character only uses a capsule, and assumes it can turn in place.”

If you find that you need inspiration in how to build the AI following bits, the source code is available on GitHub. Just read up on what Character does, and then adapt that to what Vehicle needs to do.

1 Like

@jwatte Sure. Thank You so much. I’ll see that.