# Adjust boundingBoxGizmo

**URL:** https://forum.babylonjs.com/t/adjust-boundingboxgizmo/18266
**Category:** Questions
**Created:** [February 8, 2021, 6:20pm UTC](https://forum.babylonjs.com/t/adjust-boundingboxgizmo/18266 "2021-02-08T18:20:54Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![samevision](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@samevision](https://forum.babylonjs.com/u/samevision)
#### Post date: [February 8, 2021, 6:20pm UTC](https://forum.babylonjs.com/t/adjust-boundingboxgizmo/18266/1 "2021-02-08T18:20:54Z")

</div>

Hello guys,

I am playing around with the boundingBoxGizmo. It is nice and exactly what I need for my project. But I wonder how to adjust two things:

1. I want to allow scaling of x&z-axis. y-axis should be prevented. So there is no need for the gizmo cube at top and bottom. In addition to that the gizmo cubes in the corners should scale x and z simultaneously but don’t affect y.

2. If I drag one of the gizmo cubes at a side the object scales way slower than my mouse moves. The object should scale exactly with my mouse movement.

Is it possible to fix these two issues?

Best

[https://playground.babylonjs.com/#8M51ER#2](https://playground.babylonjs.com/#8M51ER#2)

---

<div class="post-metadata">

### Author: ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)
#### Post date: [February 8, 2021, 9:41pm UTC](https://forum.babylonjs.com/t/adjust-boundingboxgizmo/18266/2 "2021-02-08T21:41:39Z")

</div>

Pinging @Cedric

---

<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: [February 9, 2021, 9:35am UTC](https://forum.babylonjs.com/t/adjust-boundingboxgizmo/18266/3 "2021-02-09T09:35:16Z")

</div>

Hi @samevision

I can add a scaling mask Vector3 that will be used to modulate the applied scale. A value of (1,0,1) will only allow a scaling on x and z.

Yes, the speed is not what it should. I’ll try to improve that.  
I’m doing my best to do a PR in the coming days.

---

<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: [February 9, 2021, 12:38pm UTC](https://forum.babylonjs.com/t/adjust-boundingboxgizmo/18266/4 "2021-02-09T12:38:55Z")

</div>

PR open [Exposed `scaleDragSpeed` and added `axisFactor` for BoundingBoxGizmo by CedricGuillemet · Pull Request #9902 · BabylonJS/Babylon.js · GitHub](https://github.com/BabylonJS/Babylon.js/pull/9902)

Exposed `scaleDragSpeed` and added `axisFactor` for BoundingBoxGizmo

In your case, set axisFactor = new BABYLON.Vector3(1,0,1);  
and gizmo.scaleDragSpeed = 1 for example.

---

<div class="post-metadata">

### Author: ![samevision](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@samevision](https://forum.babylonjs.com/u/samevision)
#### Post date: [February 9, 2021, 1:00pm UTC](https://forum.babylonjs.com/t/adjust-boundingboxgizmo/18266/5 "2021-02-09T13:00:12Z")

</div>

I love it. Thank you very much for your fast help!!

---

<div class="post-metadata">

### Author: ![samevision](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@samevision](https://forum.babylonjs.com/u/samevision)
#### Post date: [February 9, 2021, 3:39pm UTC](https://forum.babylonjs.com/t/adjust-boundingboxgizmo/18266/7 "2021-02-09T15:39:02Z")

</div>

@Cedric

I appreciate your help. In addition of using the boundingBoxGizmo I tried to adapt it so I have more control. Unfortunately I am not able to fix the pivot points: [https://playground.babylonjs.com/#V0RERN#5](https://playground.babylonjs.com/#V0RERN#5)

Can you tell me what’s the problem here?

---

<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: [February 9, 2021, 3:57pm UTC](https://forum.babylonjs.com/t/adjust-boundingboxgizmo/18266/8 "2021-02-09T15:57:00Z")

</div>

what do you want do do ? I’m not sure to understand with the PG only 🙂

---

<div class="post-metadata">

### Author: ![samevision](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@samevision](https://forum.babylonjs.com/u/samevision)
#### Post date: [February 9, 2021, 4:23pm UTC](https://forum.babylonjs.com/t/adjust-boundingboxgizmo/18266/9 "2021-02-09T16:23:28Z")

</div>

I tried to scale the cube with dragging one of the red bars. To do so the pivot point has to be at the opposite bar of the one that is dragged. I don‘t understand how you achieved that for boundingBoxGizmo.

---

<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: [February 9, 2021, 4:34pm UTC](https://forum.babylonjs.com/t/adjust-boundingboxgizmo/18266/10 "2021-02-09T16:34:33Z")

</div>

yes, the pivot is a point, imagine stitching it to the middle of the opposite face.

It’s done here [Babylon.js/boundingBoxGizmo.ts at c1711a4762335696295550a21f32492abc872306 · BabylonJS/Babylon.js · GitHub](https://github.com/BabylonJS/Babylon.js/blob/c1711a4762335696295550a21f32492abc872306/src/Gizmos/boundingBoxGizmo.ts#L351)
