- Home /

# Unity Quaternion Multiplication by Vector3

Hi guys and of course thanks before anything. I am starting to use Unity 3D in a professional environment, and I am facing a hard time trying to understand what is the goal behind multiplying a Quaternion by a Vector3 and what the result is. For example, I don understand why, in this code:

```
Vector3 idk = Quaternion.Euler(0, 45, 0) * transform.forward;
```

my Vector3 idk results in (0.7, 0.0, 0.7). I have read in several places that when you do that, you are "rotating the vector by the quaternion", but I simply don't understand the value I get or the concept I am facing. Could someone please explain me a bit better or point me to a place where I can read in detail what is happening here, where I am lost? Unity docs focuses on multiplying Quaternions by Quaternions, and I get that part, but Quaternions * Vectors are right now really hard to understand. Thanks again, and have a good day.

**Answer** by maximeb-valtech
·
Sep 05, 2017 at 09:10 PM

Indeed, multiplication of a quaternion by a vector is how you apply a quaternion transformation to a vector. In this case, it seems like your transform.forward is `(1, 0, 0)`

and you are rotating it by 45 degrees around the Y axis (either left or right). You end up with `(0.7, 0, 0.7)`

because a vector of unit 1 rotated by 45 degree is the same as `(1 * cos(45), 0, 1 * sin(45))`

. X and Z or the values getting modified and Y remains at zero because that is the axis we are rotating around. `cos(45) = sin(45) = 0.70716...`

. I hope this helps explain what is going in this line of code.

Right, +1

If you want to gain a better understanding of quaternions in general, see this numberphile video

Thank you very much, maximeb-valtech. It is a very good answer, and I get what you point very clear. Really, I had to take an angle where cos and sin are the same to make my tests... hmmm... well, thank you very much again

I'd like to make small correction: Transform.forward is (0, 0, 1). If you rotate (1, 0, 0) with above Quaternion you get (0.7, 0, -0.7).

### 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.