A little vector math problem

21973-vectormathproblem.png

I need to move pawn P to location L along the right vector of actor A (none moving static mesh), L being on the line of A’s forward vector. Or put more simply, move P along A’s right vector until they line up.

How would you do this?

Is this in 2d (You want to line up the x,y) or 3d?

It will be 3D but I suck at drawing in perspective! Was hoping the same principles would apply.

Just to clarify, the question is how to determine L.

Project point P onto the line created by A’s forward vector. Look up how to do projection with vectors and points. The behavior of how you want to move it is entirely up to you.

This function would probably do what you want. link text

Indeed, projection seems to be what I was missing. Will look into it, thanks a lot.

You could raytrace from Pawn’s forward vector and have the pawn move to the left until the ray trace hits actor A, then stop movement. Or some system like that