# How can I add two Vector3 directions together?

I have a direction to my target object, which is in a Vector3 format. I want cast a number of rays, as offsets from this initial direction.

X is the object. D is the direction the player needs to travel in. A & C are other directions that I want to cast rays towards to check for impacts.

A    D    C
\   |   /
\  |  /
\ | /
[x]


I was trying to add an offset, such as Vector3.Right to the Direction and then normalise the result, however this only works if everything is oriented towards World Space.

So how can I convert and add a direction (Vector3.right) as an offset to an existing direction?

I'm fairly sure I just have World Space and Local Space directions mixed up but can't see an easy way to convert between this with Vector3?

• myVector + Quaternion.LookRotation(myVector) * myOffset Feb 14 '17 at 6:08
• Do you have an Up vector? - I mean, the vectors XA, XD and XC need to be coplanar, but on what plane? Feb 14 '17 at 8:28
• Correct me if I'm wrong, but it looks like you're just want to rotate the vector D. This can easily be reached by multiplying the vector by complex number: betterexplained.com/articles/…. For Unity: answers.unity3d.com/questions/46770/… Feb 14 '17 at 8:38