# How to rotate object around its center?

**URL:** <https://discourse.threejs.org/t/how-to-rotate-object-around-its-center/33869>\
**Category:** Questions\
**Created:** [January 20, 2022, 7:35am UTC](https://discourse.threejs.org/t/how-to-rotate-object-around-its-center/33869 "2022-01-20T07:35:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![netrunner](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/netrunner/32/23642_2.png) [@netrunner](https://discourse.threejs.org/u/netrunner)\
**Post date:** [January 20, 2022, 7:35am UTC](https://discourse.threejs.org/t/how-to-rotate-object-around-its-center/33869/1 "2022-01-20T07:35:31Z")

</div>

Hey there! Three.js beginner here. So, I have a question. This is the code I use:  
{  
const mtlLoader = new MTLLoader();  
mtlLoader.load(‘model.mtl’, (mtl) =\> {  
mtl.preload();  
const objLoader = new OBJLoader();  
objLoader.setMaterials(mtl);  
objLoader.load(‘model.obj’, (root) =\> {  
scene.add(root);  
window.myObject = root;

```
                    });
                });
            }

```

Later, on button click in separate JS function I rotate the object like this:  
myObject.rotation.z -= 0.1;  
My problem is it’s rotating against it’s base (bottom part), not against object’s actual center.

Now I’ve searched and searched and tried number of solutions, but I guess I’m still missing how it supposed to work. Any help would be really appreciated!

---

<div class="post-metadata">

**Author:** ![hofk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/hofk/32/44944_2.png) [@hofk](https://discourse.threejs.org/u/hofk)\
**Post date:** [January 20, 2022, 8:02am UTC](https://discourse.threejs.org/t/how-to-rotate-object-around-its-center/33869/2 "2022-01-20T08:02:20Z")

</div>

Look there [BeginnerExample](https://hofk.de/main/discourse.threejs/BeginnerExample/BeginnerExample.html) step 3 and [LoadGLTFmove](https://hofk.de/main/discourse.threejs/2020/LoadGLTF/LoadGLTF.html)  
from the [Collection of examples from discourse.threejs.org](https://discourse.threejs.org/t/collection-of-examples-from-discourse-threejs-org/4315)

---

<div class="post-metadata">

**Author:** ![netrunner](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/netrunner/32/23642_2.png) [@netrunner](https://discourse.threejs.org/u/netrunner)\
**Post date:** [January 20, 2022, 10:55am UTC](https://discourse.threejs.org/t/how-to-rotate-object-around-its-center/33869/3 "2022-01-20T10:55:33Z")

</div>

Thank you! That’s definitely a step in the right direction! But I have a question, what if I use OBJLoader and notGLTFLoader? Using myObject.scene throws error:  
OBJLoader.js:464 TypeError: Cannot read properties of undefined (reading ‘updateWorldMatrix’)

---

<div class="post-metadata">

**Author:** ![netrunner](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/netrunner/32/23642_2.png) [@netrunner](https://discourse.threejs.org/u/netrunner)\
**Post date:** [January 20, 2022, 10:58am UTC](https://discourse.threejs.org/t/how-to-rotate-object-around-its-center/33869/4 "2022-01-20T10:58:44Z")

</div>

Nevermind! Fixed it!
