Undesirable Bounding Box Gizmo Custom Drag Behavior

Hey all, I’m fairly new to babylon and am having some trouble adding a custom drag behavior to the bounding box gizmo.

Playground demonstrating the issue: Babylon.js Playground

Unwanted behavior #1: The sphere position unexpectedly jumps to new locations upon multiple drags
Steps to reproduce:

  1. Click and drag the sphere to a new location
  2. Deselect the sphere by clicking on an empty space in the scene
  3. Click the sphere again and drag it only slightly.
    Result: The sphere position unexpectedly jumps.

Unwanted behavior #2: The sphere sinks into the floor plane after upon multiple drags
Steps to reproduce:

  1. Click and drag the sphere to a new location
  2. Deselect the sphere by clicking on an empty space in the scene
  3. Repeat Steps 1 and 2 multiple times
    Result: The sphere gradually sinks into the floor.

What alternative drag behavior options can be included to prevent the above issues from occurring?

Hey @mr.sudo

Re #1
I am not able to replicate that. Can’t see “a jump” even after 20+ click/drags. Just out of curiosity, what browser are you using and have you tried it in another one?

Re #2
It does seem like a bug. I would suggest you report it in “bug” category.
Adding observable to your code to track y logs:

8.881784197001252e-16
VM332:39 1
VM332:39 1
VM332:39 1
VM332:39 1
VM332:39 0
VM332:39 1.0000000000000004
VM332:39 1
VM332:39 1.0000000000000009
VM332:39 

Definitely undesired.

I believe should be reported as a bug in #bugs section. Feel free to link that post back.

Sounds great, and thank you @MarkBevels for confirming this. I’ve reclassified this post under the #bugs category.

As for unwanted behavior #1, I have a feeling that this bug is related to the sinking into the ground issue as well. Right now I’m running this playground on Chrome, although i’ve just tested it in Firefox and Safari and the problem persists.

Attached is a little video of the bug. At about 8s, I move my cursor to the right by a few pixels, and the sphere unexpectedly jumps forward towards the camera.

Solid bug report.

1 Like

pinging @Cedric

I can repro #1 but I can’t repro #2. Definitely looks like a bug to me. I’m investigating …

BTW, thank you @mr.sudo for your clean PG and explanation. It’s definitely easier to track bugs that way.

1 Like

Took me a while but the PR is live : Normalize quat/update matrix for drag behavior by CedricGuillemet · Pull Request #9968 · BabylonJS/Babylon.js · GitHub

2 Likes