I have a vector A, which represents a velocity, and a normalized vector B, which represents a direction.
I'd like to modify A, so that only the part of the velocity that doesn't go in the direction of B, remains.
Examples:
#1
A = (175,25,33)
B = (0,1,0)
Result = (175,0,33) -- Only x and z remain
#2
A = (175,25,33)
B = (1,0,0)
Result = (0,25,33) -- Only y and z remain
#3
A = (175,25,33)
B = (-0.116872,0.943617,0.309723)
Result = ?
How can I accomplish this?
I suppose I'd have to 'map' the velocity A onto a plane orthogonal to B, I'm just not sure how.
Another idea I've had is:
1) Set C = (0,1,0)
2) Calculate quaternion rotation from B to C using the cross product
3) Rotate A by the result
4) Set A.y = 0
5) Rotate A by the inverse of the result
Would that work?