Transform a Vector's components to be local to another Vector

Hi,

Vector math question. I have two vectors, a velocity vector v and a forward vector f. I want to know what the velocity vectors components are local to the forward vector…like so…

Basically, I want to know how much of the velocity vector’s magnitude runs parallel to the forward vector and how much runs perpendicular, or a Z and X component, respectively.

I’m aware that I could just instantiate a transform, make it’s rotation follow the forward axis and use TransformDirection but this has been bugging me for awhile, since it doesn’t seem too complex.

Thanks for any help,

Erik

Vector3.Project and fetch the magnitude.

Exactly what I was looking for, cheers!