Angle between 2 vectors/points on a local axis

I’m scripting a cartoon style car (which is why I’m not using wheel colliders) and need to find the angle between the front axle and back axle from the side and from the top (and eventually back) so I can set the cars pitch and yaw.

This is my first 3D game so I’ve not quite learnt all the handy maths yet. Usually I would use Atan2 in 2D but obviously I can’t use it here because as soon as the car turns the axis I use is wrong.


If you want to align the vehicle to the ground, take a look at this question - my answer gets the ground normal and aligns the vehicle (which is a CharacterController) to it.