# How to get model rotation angle from 0 to 360 while using transform Controls

**URL:** <https://discourse.threejs.org/t/how-to-get-model-rotation-angle-from-0-to-360-while-using-transform-controls/16535>\
**Category:** Questions\
**Tags:** transform, math\
**Created:** [June 25, 2020, 5:10am UTC](https://discourse.threejs.org/t/how-to-get-model-rotation-angle-from-0-to-360-while-using-transform-controls/16535 "2020-06-25T05:10:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Boris\_Bek](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/boris_bek/32/5493_2.png) [@Boris\_Bek](https://discourse.threejs.org/u/Boris_Bek)\
**Post date:** [June 25, 2020, 5:10am UTC](https://discourse.threejs.org/t/how-to-get-model-rotation-angle-from-0-to-360-while-using-transform-controls/16535/1 "2020-06-25T05:10:22Z")

</div>

Hello, People I am trying to get model angle degree from 0 to 360 is there any way to do that,  
I am using Transform Controls and when I rotate model I want to get angle from 0 to 360  
I am struggling because of Euler gives me only range from 0 to 180 and -179 to 0 and I can’t detect model is on 0 degree or 360 degrees.  
Advanced Thank You

---

<div class="post-metadata">

**Author:** ![mjurczyk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mjurczyk/32/10995_2.png) [@mjurczyk](https://discourse.threejs.org/u/mjurczyk)\
**Post date:** [June 25, 2020, 5:56am UTC](https://discourse.threejs.org/t/how-to-get-model-rotation-angle-from-0-to-360-while-using-transform-controls/16535/2 "2020-06-25T05:56:19Z")

</div>

> <https://stackoverflow.com/questions/42089919/three-js-camera-rotation-y-to-360-degrees-conversion>

I think this should help? TransformControls rotation is done using quaternions, so it’s not that straightforward to read them.

---

<div class="post-metadata">

**Author:** ![Boris\_Bek](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/boris_bek/32/5493_2.png) [@Boris\_Bek](https://discourse.threejs.org/u/Boris_Bek)\
**Post date:** [June 25, 2020, 11:59am UTC](https://discourse.threejs.org/t/how-to-get-model-rotation-angle-from-0-to-360-while-using-transform-controls/16535/3 "2020-06-25T11:59:54Z")

</div>

I coped the code and this is what I have but still it is not woriking any Idea what am I doing wrong ?

if (mode === “rotate”) {  
const euler = new THREE.Euler();  
const rotation = euler.setFromQuaternion(this.picked\_asset.quaternion);  
console.log(rotation);  
const radians = rotation.x \> 0 ? rotation.x : 2 \* Math.PI + rotation.x;  
const degrees = THREE.Math.radToDeg(radians);

---

<div class="post-metadata">

**Author:** ![mjurczyk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mjurczyk/32/10995_2.png) [@mjurczyk](https://discourse.threejs.org/u/mjurczyk)\
**Post date:** [June 25, 2020, 12:24pm UTC](https://discourse.threejs.org/t/how-to-get-model-rotation-angle-from-0-to-360-while-using-transform-controls/16535/4 "2020-06-25T12:24:39Z")

</div>

(1) But wait - you are trying to _read_ the model rotation in transform controls, or _write_ it to the model properties as an angle between 0 and 2π ? It looks like you are modifying control’s code - so just in case, second option is not possible (or not practical, at least.)

(2) `Euler gives me only range from 0 to 180 and -179 to 0` - without copying the code, just apply it to what you’ve got there. If angle is between 0° and 180°, use that value as the rotation. If value is between -179° and 0°, add 360° (2π) to it - it will result in a properly adjusted angle (-90° will equal 270° etc.)

(3) Also:

> [@Boris\_Bek](#):
>
> I can’t detect model is on 0 degree or 360 degrees.

0° is always equal 360° 🤔

---

<div class="post-metadata">

**Author:** ![Boris\_Bek](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/boris_bek/32/5493_2.png) [@Boris\_Bek](https://discourse.threejs.org/u/Boris_Bek)\
**Post date:** [July 6, 2020, 11:50am UTC](https://discourse.threejs.org/t/how-to-get-model-rotation-angle-from-0-to-360-while-using-transform-controls/16535/5 "2020-07-06T11:50:18Z")

</div>

thank you very much I found my bug

---

<div class="post-metadata">

**Author:** ![threejsman](https://avatars.discourse-cdn.com/v4/letter/t/7ba0ec/32.png) [@threejsman](https://discourse.threejs.org/u/threejsman)\
**Post date:** [March 7, 2024, 5:42pm UTC](https://discourse.threejs.org/t/how-to-get-model-rotation-angle-from-0-to-360-while-using-transform-controls/16535/6 "2024-03-07T17:42:11Z")

</div>

Would you tell us?

---

<div class="post-metadata">

**Author:** ![Boris\_Bek](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/boris_bek/32/5493_2.png) [@Boris\_Bek](https://discourse.threejs.org/u/Boris_Bek)\
**Post date:** [March 7, 2024, 5:56pm UTC](https://discourse.threejs.org/t/how-to-get-model-rotation-angle-from-0-to-360-while-using-transform-controls/16535/7 "2024-03-07T17:56:38Z")

</div>

So the rotation is represented as @mjurczyk described you need to covert that. To recive it from 0-360
