# Problem with moving the avatar in chapter 14

**URL:** <https://talk.code3dgames.com/t/problem-with-moving-the-avatar-in-chapter-14/366>\
**Category:** Uncategorized\
**Created:** [August 23, 2021, 12:46am UTC](https://talk.code3dgames.com/t/problem-with-moving-the-avatar-in-chapter-14/366 "2021-08-23T00:46:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CodingUser](https://talk.code3dgames.com/letter_avatar_proxy/v4/letter/c/e9c0ed/32.png) [@CodingUser](https://talk.code3dgames.com/u/CodingUser)\
**Post date:** [August 23, 2021, 12:46am UTC](https://talk.code3dgames.com/t/problem-with-moving-the-avatar-in-chapter-14/366/1 "2021-08-23T00:46:35Z")

</div>

Hello,

I have a problem with the code in chapter 14.  
I can’t move the fruit monster with the arrow-buttons on my computer. If I press left/right, the avatar will look in the correct direction but he don’t move. That’s my code until now:

```auto
https://www.code3dgames.com/3de/#B/lVdbbxo5FH7nV1i84FQwkFTZXZG0UkppGm2aVoFt960yMwfGzYw9a3sgNMp/3+PL3BLS1UYIBp/v3D6fCzlfyWT/9nzsPnrnOla8MESr+E1/bFIFEP3QfZR7wVNEke41/yVCx1LBSjKVHIa97Y3H5Is1cwdcaANZVooNiJ47+6EjD9MRy3NJ3pDB2D6grcHZM8hOqjtQDlR40Xd/5OG9HiHobJkC6esYBPQJ12SXggKiTbleEy6ILBXZsBzIjmcZSVlRgJj2tkwRp4LGBexI5Xlhz+jRWc8JIw3mUrEtN3tqUcuPt/N59BViI9VrOhmS0ckpvk+OUMFaXGfMoMEH+7lIWcLFZkqMKuHRyzO+SU3w6G1d5CsOwlxbAR3sUm5ggAajP+oQWJJQp4cnrXxjTEmxkDB61QCamDQkPnVI65LpAsO9ZYZbsndcJHIXcSFAfeOJScm4c/YRrKezWtt76UT8BZQzybcwc1L6++mw7WZIjvE1wb8ja8ia2b3g+qQCpE8APo424kAkn5VJ5UaxIuVxCGW0GxJ8pXgz6ZM4vIGokJpjkCL6ibZOJxMraoj2oC7TCkSC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7Ug5wcho+PWZdrLxqnQaZGqh63PqvWboVcU2X6GZaFYdpUXJS4KigYCKLBZ///wLw==

```

Thanks for helping.

---

<div class="post-metadata">

**Author:** ![chris](https://talk.code3dgames.com/user_avatar/talk.code3dgames.com/chris/32/5_2.png) [@chris](https://talk.code3dgames.com/u/chris)\
**Post date:** [August 23, 2021, 1:22am UTC](https://talk.code3dgames.com/t/problem-with-moving-the-avatar-in-chapter-14/366/2 "2021-08-23T01:22:41Z")

</div>

You have everything perfect, except for one tiny thing. In the `addAvatar()` function on line 52, you need to give it a mass of `1` by adding it after the `shape` and the `cover`:

```javascript
  var avatar = new Physijs.BoxMesh(shape, cover, 1);

```

Without that, the physics engine decides how heavy the object is based on its size. Since the avatar is 100 x 100 x 1, the physics engine thinks its mass is 10,000 – pretty heavy. That is too heavy for the `move()` function to actually move the avatar, which is what you saw.

-Chris

---

<div class="post-metadata">

**Author:** ![CodingUser](https://talk.code3dgames.com/letter_avatar_proxy/v4/letter/c/e9c0ed/32.png) [@CodingUser](https://talk.code3dgames.com/u/CodingUser)\
**Post date:** [August 23, 2021, 11:28am UTC](https://talk.code3dgames.com/t/problem-with-moving-the-avatar-in-chapter-14/366/3 "2021-08-23T11:28:17Z")

</div>

Thanks for your reply. Now the code works.
