# Calculating Relative angles

I am writing an edtior tool, and need some help with some Vector or angle math.

I have a a mesh of quads seen below. I've iterated over this mesh and generated the following data:

-The Center point of each quad (green cirle)

-The center point of the first edge (red circle)

-The direction vectors in 3D space (the blue arrows)

-and finally each quad has a list of what quads are attached to it so that I can iterate over them

What I want to do is loop over the list of neighbouring quads and calculate for each neighbour the direction (or angle) of the quads realtive to it.

Here are some examples of the results I want to achieve.

Quad 3 is surrounded on all for sides by:

Quad 4 - forward ( 0 degrees)

Quad 6 - left (270 degrees)

Quad 9 - right (90 degrees)

Quad 2 - back (180 degrees)

Quad 7 has

Quad 6 - Back (180 degrees)

Quad 8 - Right(90 degrees)

Quad 2 has

Quad 1 - Back (180 degrees)

Quad 3 - forward ( 0 degrees)

I've tried unsuccessfully a few times with caluating the angles various ways of using the Directions and/or points and can't figure it out.

**Answer** by Matt3D
·
Jun 07 at 03:05 AM

Turns out I answered my own question, I was on the right track in the first place but a syntax error was giving me the wrong angles because I was using the wrong point to calculate from.

```
Vector3 targetDir = NeighbourQuad.Center - Quad.Center;
Vector3.SignedAngle(Quad.FaceDirection, targetDir, Vector3.up));
```

This takes a Vector 3 direction and gives me the angle relative between it and a point.

### 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 to calculate the angle between two vectors? 6 Answers

Attempting to apply force to object, paralell to mouse drag. 2 Answers

Non physics determinism of floating point math across platforms 1 Answer

How can I launch a GameObject at a target if I am given everything except for its launch angle? 1 Answer