# Issue with Object rotation y

Hello,

I have an issue with rotating object.
I have simple controls that allows me to rotate the object on y. I’m using rotateY() to pass the rotation value and it works well, but, when I copy that value from object.rotation.y and set it when I init the object (for testing proposes), the rotation is wrong, it’s negative rotation. I know that Euler is between 0 - 179 degrees, but I cannot seem to find a way properly get and set the rotation value.

three things, 1) values are in radians, not degrees, 2) you need to change rotation order first before you can expect the same value in rotation.y that you passed to rotateY, and 3) negative value such as -1, for example, is the same as positive value 2π -1 (= 5.283…)

I know that the values are in radians because Euler are in radians.
The strange thing is happening when I’m rotating the values goes from 0 to ~1.55 (90deg) then back to 0 and then to -1.55.

I’m logging the value after rotateY, and the value that I’m taking and then manually put in object init (while creating it) showing me different rotation.

To me it’s a little suspicious that you are talking about rotation and position, as if you were citing one as the symptom of the other.

Maybe that’s merely a lack of precision in expression and you actually mean the same, or you are subconsciously pointing to the root of the problem. A working piece of code like in a JSFiddle or Codepen, or a screenshot or a sketch would be most helpful to clarify.

Taking your

at face value, it does make a difference if you

• 1st translate, then rotate
• 1st rotate, then translate

You cannot arbitrarily change the order of operations and still expect identical results. These operations are not commutative.

I have a rotation on Y (I’m rotating the object and camera is following it).
The values that printed goes from -1.5 to 1.5

When I take one of the value and put in object init
object.rotation.y = value
(and update the camera)
The object is looking on different direction, it never managing to do 180 degrees.

This is the pease of code in request frame animation:

`````` if( this.motion?.turn) {
this.playerModel.rotateY(this.motion.turn * deltaTime);
console.log(this.playerModel.rotation.y)
}
``````

imma gonna give up, it is one of those threads where you just cant get through to people fwiw I think he means rotation when he writes either “rotation” or “position”

I’m afraid, we need to get some linguistic precision into the problem description first.
In Three.js parlance, we are talking about scenes and objects (meshes, lights, cameras etc.).

The term “model” is not something inherent to three.js.

From your video it looks like you have a three.js scene containing some objects (meshes), including at least one camera. Now you can rotate

• the whole scene,
• one or more meshes
• the camera.

From your video it looks like you’re either rotating the whole scene, or the camera. Either way, the camera is definitely not “following” anything.

My advice is, to strip your problem down to the simplest level, i.e.:

1. 1 scene
2. 1 mesh
3. 1 camera

Then decide, what it is you want to achieve. If you don’t succeed, please provide the full code listing, not just a snippet. That shouldn’t be much, since we’re talking about the simplest possible example.

Dang. I’m an idiot, I messed the message a little bit. I did meant to rotation and I don’t even understand why I wrote position. Sorry for that!

@makc3d I mean rotation, not position. I do understand the difference (sorry for confusion) and make it work by setting the rotation order.

@vielzutun.ch I’ll try to take a part of the scene. There is a capsule that behind the camera that if follow.

I made it work by setting rotation order. Now I face small issue that I probably fix soon, when using tweenjs and reach 360 degree, it’s do full spin again, but I believe I’ll find the source of the issue