Lateral difference between two Vectors

Hi, I’m fairly new to unity (and 3D geometry), and I apologize if I misuse any terms, or if this question has been asked in a different way.

I would like to know how to get just the lateral / perpendicular / tangential component of the difference between two Vectors. I’ll explain:

if Velocity is (2, 2, 0)
and Acceleration is (1, 1, 1)
the LateralComponent is (0, 0, 1))

Practical example:
A ball is skidding North on ice (Velocity). It can try to roll (Acceleration) but if it tries to roll North it doesn’t speed up. However if it tries to roll north-west, it speeds up towards the west (LateralComponent).

Simpler example: Lateral component is your sideways movement when trying to run against a wall in an FPS.

Is there a good way to get this? I can only figure out how to get the difference:

Difference = Acceleration - (Vector3.ClampMagnitude(Velocity, Acceleration.magnitude));

Any guidance is much appreciated.

I’m a bit fuzzy on the frame of reference here. Assuming the frame of reference is the moving object, you an use Transform.InverseTransforDirection(). For example:

var localVelocity = transform.InverseTransformDirection(rigidbody.velocity);

Now the ‘x’ component of ‘localVelocity’ will be relative to the object. So if you are looking for sideways movement, it will be ‘localVelocity.x’.