# How do objects move only along the x and z axes?

**URL:** <https://forum.babylonjs.com/t/how-do-objects-move-only-along-the-x-and-z-axes/53073>\
**Category:** Questions\
**Created:** [August 29, 2024, 1:24am UTC](https://forum.babylonjs.com/t/how-do-objects-move-only-along-the-x-and-z-axes/53073 "2024-08-29T01:24:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rookiewxy](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/rookiewxy/32/35612_2.png) [@rookiewxy](https://forum.babylonjs.com/u/rookiewxy)\
**Post date:** [August 29, 2024, 1:24am UTC](https://forum.babylonjs.com/t/how-do-objects-move-only-along-the-x-and-z-axes/53073/1 "2024-08-29T01:24:56Z")

</div>

Right click and drag, hoping that the object will only move along the x and z axes, I did think about using pointerDragBehavior but he didn’t have the concept of drag groups, that is, drag in one direction, the objects don’t move together, they move against one object

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

---

<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:** [August 29, 2024, 1:32am UTC](https://forum.babylonjs.com/t/how-do-objects-move-only-along-the-x-and-z-axes/53073/2 "2024-08-29T01:32:56Z")

</div>

cc @Cedric our gizmo wizard

---

<div class="post-metadata">

**Author:** ![CrashMaster](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/crashmaster/32/23662_2.png) [@CrashMaster](https://forum.babylonjs.com/u/CrashMaster)\
**Post date:** [August 29, 2024, 7:30am UTC](https://forum.babylonjs.com/t/how-do-objects-move-only-along-the-x-and-z-axes/53073/3 "2024-08-29T07:30:26Z")

</div>

You could use dragging with parenting maybe so that moving the parent also moves the child. The parent would be an invisible bounding box around your group of object for example.

When you right click with the ArcRotateCamera, you actually pan the camera long its local X and Y axis, the objects themselves don’t move 👍

---

<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:** [August 29, 2024, 8:50am UTC](https://forum.babylonjs.com/t/how-do-objects-move-only-along-the-x-and-z-axes/53073/4 "2024-08-29T08:50:46Z")

</div>

what @CrashMaster said 🙂  
It’s camera panning, not object translation.  
You can parent the meshes you want to translate at click pointer down and unparent when click pointer up. And drag/translate the parent transform.
