I’m working on camera movement for my character since 3 week and i always have issue with rotation value …
So today i decided to redo the entire code and i found that UE4 give me wrong value .
On begin play i get the rotation of my character :
(i call a function but i show what it does few lines later don’t worry )
Then i check this rotation and depending of the value i set it to 0.0 , 90.0, 180.0, or 270.0 :
After that i set a rotator variable to store this rotation (i use this rotation as a default rotation ):
Then i call a function i’ve made to be sure that my rotation (on yaw) is between 0 and 360 to get rid of negative value :
(what the function do : )
I set 4 rotator variable with 4 different value (for the 4 angles : 0 , 90 , 180 , 270) :
(i use collapsed node to get some space )
(as you can see i set the result in another rotator variable to use it later and dont risk to alterate the first one (char default clamp rot …))
Inside the collapsed node :
Then i set the world rotation of my mesh (my character mesh ) with the value (Default Rot … ) :
After that i have a piece of code who basically set the right rotation when i press the right key :
every tick (with a delay to avoid spam ) i print the value of the rotation of my mesh (world Rot ) and the value of the backward variable (charRotBW ) :
The result in play mode :
(the mesh world rotation is blue and the backward value is orange )
As you can see the actual mesh world Rotation is 0.0 (no problem ) and the backward world rotation is at 180.0 (here again no problem )
But look at this :
You see ? i have a variable with a yaw value of 180 , and when i set the world rotation of my mesh with this variable the value go from 180.0 to -179.9 … WTF !!? why 179.9 ? and why negative value ?
so yeah i’m done with it , i’ve almost lost 3 week of work and i don’t understand the value change .
all idea are welcome , if you need more info ask me
hope you guys can figure it out and thanks for your help and for taking your time to read me .
merry christmas and happy new year !