# How to get absolute rotation of a parented mesh?

**URL:** <https://forum.babylonjs.com/t/how-to-get-absolute-rotation-of-a-parented-mesh/4632>\
**Category:** Questions\
**Created:** [July 21, 2019, 3:20pm UTC](https://forum.babylonjs.com/t/how-to-get-absolute-rotation-of-a-parented-mesh/4632 "2019-07-21T15:20:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abstract](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/abstract/32/1880_2.png) [@Abstract](https://forum.babylonjs.com/u/Abstract)\
**Post date:** [July 21, 2019, 3:20pm UTC](https://forum.babylonjs.com/t/how-to-get-absolute-rotation-of-a-parented-mesh/4632/1 "2019-07-21T15:20:26Z")

</div>

How do I get the “absolute rotation” after I remove the parent? When I no longer want a parent attached to the mesh, I want to remove the parent attribute but keep the position and rotation its currently at prior to its parent set to null. Cloning the “rotation” attribute doesn’t work correctly. I need the absolute rotation.

```
this.entity.mesh.parent = box;
// entity moves around randomly at this time.

setTimeout(() => {
 const oldPos = this.entity.mesh.getAbsolutePosition().clone();
    const oldAngle = this.entity.mesh.rotation.clone();

    this.entity.mesh.parent = null;

    this.entity.mesh.position = oldPos;

    // doesnt work correctly.
    this.entity.mesh.rotation = oldAngle;
}, 10000)
```

---

<div class="post-metadata">

**Author:** ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)\
**Post date:** [July 21, 2019, 4:21pm UTC](https://forum.babylonjs.com/t/how-to-get-absolute-rotation-of-a-parented-mesh/4632/2 "2019-07-21T16:21:47Z")

</div>

Old forum [Get absolute rotation of child mesh... - Questions & Answers - HTML5 Game Devs Forum](http://www.html5gamedevs.com/topic/31288-get-absolute-rotation-of-child-mesh/#comment-179628)

---

<div class="post-metadata">

**Author:** ![Abstract](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/abstract/32/1880_2.png) [@Abstract](https://forum.babylonjs.com/u/Abstract)\
**Post date:** [July 21, 2019, 4:28pm UTC](https://forum.babylonjs.com/t/how-to-get-absolute-rotation-of-a-parented-mesh/4632/3 "2019-07-21T16:28:10Z")

</div>

Beautiful, and for anyone who also has this question, this still works in Babylon.js 4

```
var rotation = Quaternion.Identity()
var position = Vector3.Zero()

child.getWorldMatrix().decompose(Vector3.Zero(), rotation, position)
﻿
if (child.rotationQuaternion) {
child.rotationQuaternion.copyFrom(rotation)
} else {
rotation.toEulerAnglesToRef﻿(child.rotation)
}

child.parent = undefined

child.position.x = position.x
child.position.y = position.y
child.position.z = position.z
```

---

<div class="post-metadata">

**Author:** ![Laureano](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/laureano/32/10237_2.png) [@Laureano](https://forum.babylonjs.com/u/Laureano)\
**Post date:** [January 17, 2024, 2:37pm UTC](https://forum.babylonjs.com/t/how-to-get-absolute-rotation-of-a-parented-mesh/4632/4 "2024-01-17T14:37:26Z")

</div>

hey There!  
looking for parented mesh world rotation at the moment…  
do you happend to have a playground using that technique?

cheers!

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [January 17, 2024, 2:57pm UTC](https://forum.babylonjs.com/t/how-to-get-absolute-rotation-of-a-parented-mesh/4632/5 "2024-01-17T14:57:56Z")

</div>

Waking up a 4 years old topic might not work as expected 🙂  
The method, however, should still work correctly. Have you tried it?

---

<div class="post-metadata">

**Author:** ![Laureano](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/laureano/32/10237_2.png) [@Laureano](https://forum.babylonjs.com/u/Laureano)\
**Post date:** [January 17, 2024, 3:00pm UTC](https://forum.babylonjs.com/t/how-to-get-absolute-rotation-of-a-parented-mesh/4632/6 "2024-01-17T15:00:57Z")

</div>

yeah! that is actually true…

I couldn’t understand how to apply it. I’m not such a great coder  
But found a differnte solution one minute ago!

`mesh.rotationQuaternion = nestedMesh.absoluteRotationQuaternion;`

That solved what i wanted to do 🙂
