- Home /
Translate Vector3 by Vector3
I have a vector position and a vector that i need to translate the position by.
I know of transform.Translate(vector, relative);
How can I translate the vector in a similar fashion?
Answer by Owen-Reynolds · Jun 16, 2013 at 08:50 PM
Something like transform.Translate(0,0,1)
takes the rotation into account. So, it's doing a lot of math to figure out where "+1 z" really goes.
But just your position vector doesn't have a facing. That means all math is global, which is easy: A=A+B;
or A=A+Vector3.forward;
If you are faking a transform, with a quaternion Q and a vector position A, use: A=A+Q*B;
. That will move by a version of B rotated by Q.
But how about Space.Self and Space.World parameter in this equation?
It depends. $$anonymous$$ost people use transform.forward and things like that, for local space.