Adjust boundingBoxGizmo

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

Pinging @Cedric

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.

1 Like

PR open Exposed `scaleDragSpeed` and added `axisFactor` for BoundingBoxGizmo by CedricGuillemet · Pull Request #9902 · BabylonJS/Babylon.js · GitHub

Exposed scaleDragSpeed and added axisFactor for BoundingBoxGizmo

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

1 Like

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

@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

Can you tell me what’s the problem here?

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

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.

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

1 Like