- Home /

# Result of subtracton vectors

Hello, lets asume I have got 2 boids (/agents/objects/whatever) and they are moving forward with some vector v.

**I am wondering what vector is result of that operation ( IN 3D !! ):**

Vector3 vector = neighbour.Position - Position;

**And also what angle will it return when compairing these:**

float angle = Vector3.Angle(vector,transform.up);

I wanted to get this green angle - between forward vector v1 and position of v2. And i am wondering is this right

I would be grateful for answer

**Answer** by BastianUrbach
·
Dec 19, 2020 at 04:12 PM

neighbour.Position - Position is the vector from Position to neighbour.Position. If you start at Position and move by this vector then you end up at neighbour.Position. If you think of the vector as an arrow and place its starting point at Position then the tip will be at neighbour.position.

Using the names from the pictures the green angle can be calculated like this:

Vector3.Angle(b2.position - b1.position, v1)Whether that is the same as what you wrote depends on how those names translate to the names you use in your code.

If b1 is at Position, b2 is at neighbour.Position and transform.up is v1 then it should be correct.

Thank You! That is exacly what I needed to know.

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.

### Follow this Question

### Related Questions

How can I calculate the Vector3 b using Vector 3 a pos with an angle? 1 Answer

Angle between two lines in 2D 3 Answers

How do I find slope on a spherical terrain 2 Answers

Find Vector3 from a starting Vector3, angle, and distance. 1 Answer

Vector3.Angle returning wrong values for vectors with small components 2 Answers