I'm trying to make a VehicleBody (https://docs.godotengine.org/en/stable/classes/class_vehiclebody.htm ) move to a target using a script. The class uses the property "steering" to get a direction, so I just used:
var fwd = car.velocity.normalized()
var target_vector = (steering_target.get_global_transform().origin -
var distance = target_vector.length()
var steer = fwd.dot(target_vector.normalized())
fwd just gives the forward direction, and is working as intended, and the rest gets the direction to the target and uses a dot product to get the cosine of the angle. Because steering should be between -1 and 1 this is fine and I don't even bother with acos.
But this isn't working, the car always turns to the same direction, no matter what side (left or right) the target is.
Any one tried anything similar? Any ideas on what could be? There's a better way to steer a VehicleBody towards a target?