AI movement in a 3D world

Hi everyone.

I’m writing my first 3D game in Panda3D.

My game’s main character uses a Roaming Ralph like control, and my AI character uses the same control, except he’s not getting insturctions from the keyboard, but rather randomly.

I would like to make my AI character follow the main character. Anyone has an idea how to do such a thing?

I tried messing with slopes and positions, but I was unlucky. The thing is, since the movement is set by the current model.getH() value, I don’t know when to stop my model from turnning around and start moving forward.

Thanks in advance guys :slight_smile:

Have you tried just measuring the distance between the two characters so that the NPC maintains that distance? I dont think I would try and have him obey the key commands sent to the main actor. Rather I would just have him check if the actor moves and follows him.

Then just just for collisions with solids and adjust position.

Also search the forums there is a code written that uses multi party movement for multiple character control. I don’t remember what the name of it was though.

JB

P_agony, download, run and study the code you’ll find here - that’s all you need

Thanks guys for you help!