• News

• Industries

• Learning & Support

• Community

• Marketplace

# Get the Vector3 between two Vector3?

Hi,

What’s the best way to get the Vector(or “Direction”) between two Vectors? Let’s say Vector #1 is pointing 45 degrees to the left and 45 up and Vector #2 is pointing 45 degrees to the right and also 45 up, then the Vector I’m after would point straight forward and 45 up.

Not sure that explanation made sense.

Thanks,

If I understand you, you want to consider two vectors as being on a plane and you want the third vector to be what you’d get if you rotated the first vector halfway to the second vector?

i.e. if Vector A is at 15° above the horizon and Vector B is at 45° above the horizon then the result will be 30° above the horizon?

The Easy Math way to calculate the bisecting angle vector is to take the lengths of each vector and do the following: (Length1 * Vector2) + (Length2 * Vector1).

Be aware though that while this vector defines the correct DIRECTION, it’s going to be ridiculously longer than the other two. So to scale it back down to size you’d probably want to normalize it and then multiply it by (Length1+Length2)/2 or the average of the other two lengths… At least assuming length mattered in this case.

Ah, no. Heh, guess the explanation sucked.

I need them to be in 3D and **not **calculated on a plane.

But thanks!

try this

(V1+V2)/2

+1 for Mhousse’s answer.

Correct.

http://puu.sh/hb587/46a7044a57.png

Adding A to B will result in A+B. Half of this will give you the middle of both points.
That’s the same for 3D.

Well… That was easy.

Thanks a lot! Works like a charm.