Turn towards object

Hello and thanks for reading

So I want to tell a vehicle object (car) to turn towards a waypoint ( I cannot use a steering actuator ).

I think this is what I need to do. I am struggling with the vector/orientation/maths side of things.

  1. work out if waypoint (.worldPosition ?) is on -x or +x of cars (.localPosition?) axis
  2. tell car to turn accordingly (the higher -x or +x is, the sharper the turn.

here is some scrappy code that might help clarify (or make things worse). It doesn’t currently work quite as planned:

    interest = obj[own['waypoint']]
    #print(own.worldPosition[0],own.worldPosition[1], interest.worldPosition[0],interest.worldPosition[1])
    new_vect_x = interest.worldPosition[0] - own.worldPosition[0]
    new_vect_y = interest.worldPosition[1] - own.worldPosition[1]
    new_vect = [new_vect_x, new_vect_y]
    colRot = interest.worldOrientation.to_euler()[2]
    ownRot = own.worldOrientation.to_euler()[2]
    '''if colRot >= ownRot:
        turn = 0.1
    elif ownRot >= colRot:
        turn = -0.1'''
    if new_vect > [0.0,1.0]:
        turn = -0.1
    elif new_vect < [0.0,1.0]:
        turn = 0.1
        turn = 0

You can use the trackTo actuator

Thanks Monster, I will investigate this. Dunno why I haven’t used it before.