# Thread: vector not rotating, probably syntax

1. ## vector not rotating, probably syntax

Code :
```std::cout<<"Set Euler angles: "<<std::endl;
std::cout<<"Pitch THETA (elevation) = ";
std::cin>>pEuler->pitchAngle;
std::cin>>pEuler->yawAngle;
std::cout<<"Roll PSI = ";
std::cin>>pEuler->rollAngle;
//convert Euler angles to a unit vector from a unit circle
float Vx = 0, Vy = 0, Vz = 0;
Vx = cos(pEuler->yawAngle) * cos(pEuler->pitchAngle);
Vy = sin(pEuler->pitchAngle);
Vz = sin(pEuler->yawAngle) * cos(pEuler->pitchAngle);
pEulerVec->Eulervec3D = {Vx, Vy, Vz};
std::cout<<glm::to_string(pEulerVec->Eulervec3D)<<std::endl;
pNorm->normalize_it();
glm::rotate(12.0f, pEulerVec->Eulervec3D);
std::cout<<glm::to_string(pEulerVec->Eulervec3D)<<std::endl;
return 0;```

After I apply rotate 12.0f to Eulervec3D vector, the values are the same. I expected them to be not the same.

Set Euler angles:
Pitch THETA (elevation) = 34
Roll PSI = -200
vec3(-0.707897, 0.529083, -0.467924)
<--- rotation occurs?
vec3(-0.707897, 0.529083, -0.467924)

What am I doing wrong?

2. Originally Posted by technologist
Code :
`	glm::rotate(12.0f, pEulerVec->Eulervec3D);`
This returns a matrix corresponding to a rotation of 12 radians about the axis defined by pEulerVec->Eulervec3D. It doesn't modify its arguments, and you aren't using its return value.

3. ## update on vector rotation question

I understand rotations better. I have a question: when the axis of rotation(s) is(are) set, are the ones spared unaffected by the function?
For e.g.:
Code :
```        std::cout<<"Rotate it:";
glm::mat4 trans = glm::mat4(1.0);
trans = glm::rotate(trans, 12.0f, glm::vec3(1, 0, 0));
pEulerVec4D->Eulervec4D = trans * pEulerVec4D->Eulervec4D;
std::cout<<glm::to_string(pEulerVec4D->Eulervec4D)<<std::endl;```

Rotate it:vec4(-5.605715, 14.849055, -2.020269, 1.000000)

---->glm::vec3(1, 0, 0))

This indicates rotating a vector on the x axis?;
But peering deeper into the code the other axes have some changes too.

4. Originally Posted by technologist
Code :
```        std::cout<<"Rotate it:";
glm::mat4 trans = glm::mat4(1.0);
trans = glm::rotate(trans, 12.0f, glm::vec3(1, 0, 0));
pEulerVec4D->Eulervec4D = trans * pEulerVec4D->Eulervec4D;
std::cout<<glm::to_string(pEulerVec4D->Eulervec4D)<<std::endl;```

Rotate it:vec4(-5.605715, 14.849055, -2.020269, 1.000000)

---->glm::vec3(1, 0, 0))

This indicates rotating a vector on the x axis?;
Yes, you're rotating about the X axis. The X coordinate will remain unchanged, the Y and Z coordinates will change.