I am trying to normalise the vector by calling glm::vec3(x,y,z) = glm::normalize(glm::vec3(x,y,z)) but when I print the new x,y,z they seems not correct since some values bigger than 1
Asked
Active
Viewed 339 times
1 Answers
1
When you do:
glm::vec3(x,y,z) = glm::normalize(glm::vec3(x,y,z));
you are creating a temporary and assignint to it the results of normalization. At the end of instruction, the temporary will be deleted.
In order to this to work, try something like this:
glm::vec3 v = glm::normalize(glm::vec3(x,y,z));
and look for values in v.x
, v.y
, and v.z

Amadeus
- 10,199
- 3
- 25
- 31