# Cannot read property 'rotation' of undefined

**URL:** <https://discourse.threejs.org/t/cannot-read-property-rotation-of-undefined/24193>\
**Category:** Questions\
**Tags:** transform\
**Created:** [March 9, 2021, 2:14am UTC](https://discourse.threejs.org/t/cannot-read-property-rotation-of-undefined/24193 "2021-03-09T02:14:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DatsGabs](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/datsgabs/32/16896_2.png) [@DatsGabs](https://discourse.threejs.org/u/DatsGabs)\
**Post date:** [March 9, 2021, 2:14am UTC](https://discourse.threejs.org/t/cannot-read-property-rotation-of-undefined/24193/1 "2021-03-09T02:14:56Z")

</div>

I tried loading with GLTFLoader. I get that it’s asynchronous therefore the declaration occurs after the animate function is called. It’s just that I don’t know how to get it to work. The thing I’ve tried is calling the animate function in the loader but doesn’t feel quite right

Link to the code:

> <https://gist.github.com/DatsGabs/0a5dd2d1a2d8c63b6d8390a84b3434f9>

---

<div class="post-metadata">

**Author:** ![dubois](https://avatars.discourse-cdn.com/v4/letter/d/e9c0ed/32.png) [@dubois](https://discourse.threejs.org/u/dubois)\
**Post date:** [March 9, 2021, 4:18am UTC](https://discourse.threejs.org/t/cannot-read-property-rotation-of-undefined/24193/2 "2021-03-09T04:18:09Z")

</div>

Try putting

```javascript
if(model) model.rotation.y -= 0.1

```

What happens is, the program tries to access the property `rotation` but your `model` is undefined, so it complains about not being able to access the property of a non-existing object.
