Hi all!. I made a car using VehicleBody. When you make it jump down a ramp you lose control while it is in the air.
I'm trying to build a mechanic that allows you to rotate it a bit in the air to land in a better way. (Like GTA and those kind of games)
I partialy achieve this by checking if the car is not grounded and if so you can rotate it with the same control keys. (WASD)
I am using something like this:
(If car is in air):
if Input.is_action_pressed("Forward"):
angular_velocity.x = -1
if Input.is_action_pressed("Reverse"):
angular_velocity.x = 1
if Input.is_action_pressed("Left"):
angular_velocity.z = 2
if Input.is_action_pressed("Right"):
angular_velocity.z = -2
The problems is that my car rotates relative to world or relative to axis (I dont know).
When you jump towards the X axis (or lets say North) and hit "Forward key" you can control pitch.
But when you jump towards the Y axis (or lets say East) and hit "Forward Key" you can control rol.
I want to control allways pitch with forward and backwards key and rol with left and right.
How can I manage to do that?
Maybe my explanations is a little confusing (Im not an english speaker).
Let me know if more info is needed.
Thanks!