# How to use moveWithCollisions with a composed object?

**URL:** <https://forum.babylonjs.com/t/how-to-use-movewithcollisions-with-a-composed-object/31909>\
**Category:** Questions\
**Created:** [July 4, 2022, 5:37pm UTC](https://forum.babylonjs.com/t/how-to-use-movewithcollisions-with-a-composed-object/31909 "2022-07-04T17:37:01Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Agigas](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/agigas/32/25292_2.png) [@Agigas](https://forum.babylonjs.com/u/Agigas)\
**Post date:** [July 4, 2022, 5:37pm UTC](https://forum.babylonjs.com/t/how-to-use-movewithcollisions-with-a-composed-object/31909/1 "2022-07-04T17:37:01Z")

</div>

Hello!

I am trying to make a 3D game with Babylonjs, and I am currently working on enemies’ movements and physic. I struggle to use the moveWithCollision method on my “avatar” class, extending the Mesh class.

Setting the avatar’s physic with an Ellipsoid doesn’t seem to work as no collisions are detected and avatars go through each other. If I try to set the checkCollisions attribute of a sub mesh to true instead, the avatar doesn’t follow the direction given at all.

Here’s a playground that sums up my problem:

> **[Babylon.js Playground](https://playground.babylonjs.com/#ZGVPLS%2318)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

How should I proceed so my avatars work with collisions and all related things _and_ move as expected with the moveWithCollisions method?

Thanks a lot for reading me!

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [July 4, 2022, 9:12pm UTC](https://forum.babylonjs.com/t/how-to-use-movewithcollisions-with-a-composed-object/31909/2 "2022-07-04T21:12:39Z")

</div>



---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [July 6, 2022, 5:36pm UTC](https://forum.babylonjs.com/t/how-to-use-movewithcollisions-with-a-composed-object/31909/3 "2022-07-06T17:36:07Z")

</div>

I get better result when setting the tail with collisions

[move With Collisions | Babylon.js Playground (babylonjs.com)](https://playground.babylonjs.com/#ZGVPLS#25)

There is something going wrong with the body. Can you open an issue @carolhmj . I won’t have time to check it before going on vacation.

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [July 6, 2022, 5:53pm UTC](https://forum.babylonjs.com/t/how-to-use-movewithcollisions-with-a-composed-object/31909/4 "2022-07-06T17:53:05Z")

</div>

[MoveWithCollisions issues · Issue #12710 · BabylonJS/Babylon.js (github.com)](https://github.com/BabylonJS/Babylon.js/issues/12710) Created! In the meantime, using `MakeNotPickableAndWrapInBoundingBox` seems to be a workaround 😃 [move With Collisions | Babylon.js Playground (babylonjs.com)](https://playground.babylonjs.com/#ZGVPLS#26)

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [July 6, 2022, 5:53pm UTC](https://forum.babylonjs.com/t/how-to-use-movewithcollisions-with-a-composed-object/31909/5 "2022-07-06T17:53:12Z")

</div>



---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [July 21, 2022, 9:54am UTC](https://forum.babylonjs.com/t/how-to-use-movewithcollisions-with-a-composed-object/31909/6 "2022-07-21T09:54:32Z")

</div>

The avatar does not have geometry information and is skipped by the collision detection. The solution proposed by @carolhmj is the best one: create geometry (boundingBox geometry) and move it.  
This way, the other avatar is properly tested against the ellipsoid.

---

<div class="post-metadata">

**Author:** ![Agigas](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/agigas/32/25292_2.png) [@Agigas](https://forum.babylonjs.com/u/Agigas)\
**Post date:** [July 21, 2022, 10:22am UTC](https://forum.babylonjs.com/t/how-to-use-movewithcollisions-with-a-composed-object/31909/7 "2022-07-21T10:22:44Z")

</div>

Thanks a lot! 😄

---

<div class="post-metadata">

**Author:** ![Lemcat](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/lemcat/32/44469_2.png) [@Lemcat](https://forum.babylonjs.com/u/Lemcat)\
**Post date:** [January 2, 2025, 6:41am UTC](https://forum.babylonjs.com/t/how-to-use-movewithcollisions-with-a-composed-object/31909/8 "2025-01-02T06:41:57Z")

</div>

What is BoundingBoxGizmo there? I thought the gizmos is something like visual debug lines, but it looks that I don’t see any gizmos there 😃  
Why does gizmos can handle collisions? It’s hard to understand for me 😀  
So that Gizmo creates a collider (actually bounding box) for a Mesh?

Why do we do those meshes not pickable? What if we need to pick that avatar mesh?

Sorry, I didn’t found any documentation on that.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [January 2, 2025, 7:34pm UTC](https://forum.babylonjs.com/t/how-to-use-movewithcollisions-with-a-composed-object/31909/9 "2025-01-02T19:34:10Z")

</div>

The thread is more than 2 years old, and it looks like a lot of questions 🙂

Could you start a new one with a simple targeted repro of your issue and we could try to help as best as possible.
