How do I obtain an object's local Z velocity?

I am trying to get my car’s velocity, so that I can adjust the steering sensitivity dynamically. No matter what I do, it returns the GLOBAL velocity, which doesn’t help me at all.

This:

LocalVelocity = transform.InverseTransformDirection(PlayerCar.rigidbody.velocity).z;

returns the exact same output as this:

LocalVelocity = PlayerCar.rigidbody.velocity.z;

Why is this not converting it to local?I thought that’s what the InverseTransformDirection did?!?!

I have tried applying it to just the z axis (as above) and also the the whole Vector3… both results are identical.

I think the problem is that you are using your own transform, not the PhysicsCar transform. It should be:

LocalVelocity = PlayerCar.transform.InverseTransformDirection(PlayerCar.rigidbody.velocity).z;