BGE - Nav Mesh Pathfinding - Curves?

Notes: While I have some experience in Blender 2.79, I have no experience with Python. I have done minimal programming on other projects, so I understand some of the concepts and can get the gist of Python scripts.

I was attempting to make an “AI” for a racing game and came up with the following logic:

Property = “go” / Value = 0

Keyboard sensor = w / AND / Message actuator = “start”

Message sensor = “start” / AND / Property actuator “go” ADD 1

Property Sensor = “go” If “go” =1 / AND / Steering actuator = Pathfind, Target = cpoint1 Path= Navmesh

Collision Sensor = cpoint1 / AND / Property actuator “go” ADD 1

Property Sensor = “go” If “go” =2 / AND / Steering actuator = Pathfind, Target = cpoint 2 Path=Navmesh

etc

This works for getting the object round the track, but as it follows a straight line to the next target, it doesn’t work so well on corners.

I had two ideas to fix this, but neither is a great fix, so any advice would be appreciated.

Idea 1: Place a sh*tton of targets on the radius of the corner, so that I make a curving path from many smaller straight lines. This should work, but requires a lot more logic bricks.

Idea 2: Place invisible ghost objects on the inner and out edge of the corner. Set them as obstacles. This should force the actor into a more natural line, but means it has to go in the middle.

Thank you for reading and any advice given. :slight_smile:

you need use empty steering actuator for navigation - steering = cont.actuators[‘Steering’]
steering.target = # assign objects from you scene for tracking, from steering use angular velocity and rotation speed - if you change this values in road rot you get low than angle in rotation in road location and you get low than objects for treking. For rotation in road location curve use 3 empty and low rotation speed in steering actuators this make slow tracking direct - use property object for insert this property in steering values this get for you full control under you units