Hey there,
I am working on a little project where you drive a car in 3d space. Controls are accomplished by adding force to a rigidbody and rotating the gameobject in the direction of the force vector.
The direction vector is just calculated from touch inputs (its for mobile).
I want to polish the game a bit and add tilting and wheelturning to the car. For that I would need to register which way the car is turning and I just can´t seem to find a simple solution to that…
Could somebody please give me a hint to find the right track?
Really appreciate any help!
Thanks, Dan
You just said it’s turning in the direction of the force vector, right?
Yes exactly. For example you touch the screen and drag to the right the car will follow no matter if it’s going along z in negativ or positive direction (if that makes sense)
So how is the rotational value that you need different from the one that you already have?
You mean like compare the change of the cars forward to a global vector ?
No, I literally mean “what precisely do you already have, and what precisely do you need to get?” Because at the top-level abstract description they sound identical. You need to know how the car is rotating, but you are the one rotating the car so the way it’s rotating is “however you’re already doing it.”
Probably there’s some distinction in the way the data is expressed, and probably Unity provides some function for doing exactly the conversion you need, but I can’t tell you what that function is until I understand mathematically how you need the data to be transformed.
I already have a direction vector from a “touch-drag”-input. I need to compare two of those direction vectors (maybe “recorded” with a short delay) to calculate from the change between them, if the object is rotating clockwise or counterclockwise. I hope this is what you needed to know 
To calculate the change between two vectors, just subtract them.