Godot Version
Godot.stable.4.4
Question
Hello! I have recently started using an AnimationTree for a racing game I’ve been making recently, in this game I have a 3D model with steering animations. Its a BlendSpace1D that has a value from -1 to 1, and in my kart script assign the steer value based on my karts turn velocity.
var TurnVelocity : float = 0.0
var SteeringPath = "parameters/Idle+Steering/Steering+Idle/blend_position"
func process(delta):
TurnVelocity = lerpf(TurnVelocity,Input.get_axis("Left","Right"),5*delta)
var AnimTree : AnimationTree = %AnimTree
AnimTree.set(SteeringPath,TurnVelocity)
And this works wonderfully! However I also have an AI kart with basically the same stats, however I cant seem to find a way to get a turn direction for the AI
func process(delta):
var Direction = (global_position*Vector3(1,0,1)).direction_to(Offset.global_position*Vector3(1,0,1))
var NewKartRotation = atan2(Direction.x,Direction.z) + deg_to_rad(180)
KartMeshRoot.global_rotation.y = lerp_angle(KartMeshRoot.global_rotation.y,NewKartRotation,5*delta)
Is there a way to get the direction the AI player is turning and also get the turn strength as a float?
Any help is appreciated!