Hello everyone,
i have been struggeling on this topic for over two weeks. i want to rotate a gameobject with mouse in a limited range. x axis from 0 to 60. y axis from 0 to 360, z axis from 0 to 60.
this is what i did.
1. get mouse delta position x,y.
2. multiply the float x,y with -10000 and 10000
3. rotate the gameobject in axis x with float y, axis y with float x
4. get the current rotation from gameobject, eulerangle x, eulerangle y, eulerangle z as variante.
5. clamp the eulerangle x ,z between 0 to 60
6. set rotation with eulerangle x , eulerangle z
however, this works in a strange way, in case of max value, when the limit is reached, the gameobject doesnt go over, but in case of min value, it is always return to max value again. so my gameobject get not smoothly rotating, it shakes always like crazy.
I have tried some Direction as follows.
1. get signed angle to target.
2. set another event to compare the float min, but it stucks in the compare state.
can someone help me out of this??