New PlaneRotationGizmo performance issues

I’ve found something. Basically, once a rotation plane almost aligns with camera (when the plane is flat), only the front part of the plane is accessible. So when you click and drag the lower (on screen) part of the rotation circle, it select the top part, making the selection kind of inverted.

It seems been that way for a long time, I got back to this change by @sebavan

If I change the maxDragAngle to Math.PI * 18 / 20; it improves the selection.

Can you help us figure out this issue @sebavan ?

1 Like

looks like it changes here use existing rotation if rotation quaternion doesnt exist, move scali… · BabylonJS/Babylon.js@6faffa1 · GitHub

maybe this should be a parameter ?

Not a big fan for a new parameter is this case :confused:

so if it does not break the rest I am all in for changing it and maybe a static would do for the default just in case of edge case ?

2 Likes

PR is live maxDragAngle update/accumulated angle for query by CedricGuillemet · Pull Request #9981 · BabylonJS/Babylon.js · GitHub
Thank you for reviewing it @mrlooi
To tweak the plane orientation, change the maxDragAngle this way:
BABYLON.PlaneRotationGizmo.maxDragAngle = 0;
0 will not limit interaction

2 Likes

Thanks a million @Cedric @sebavan !!

Quick question re the angle: Is it agnostic to the relative camera position? Suppose I rotate the x-axis 90 degrees in world space. Will the angle values always be 90 degrees, or will it sometimes be -90 depending on the camera position? Would be great if the former!

Also, how do I enable gizmo drags to continue if the mouse goes outside the canvas?

@mrlooi Angle is relative so it can be negative depending of the direction of the drag.
I don’t know if it’s possible to keep dragging when pointer is outside the canvas. I guess @PolygonalSun will have more insights :slight_smile:

Thanks @Cedric !
@PolygonalSun keen to hear if dragging outside the canvas is doable in the gizmo class, or we’ll have to define our own window logic and pass to gizmo class e.g. via scene.pointer etc (which sounds like a painful task) :slight_smile:

Fairly sure you’ll have to overwrite the pointerevents to use window events instead of canvas, i don’t think they’re exposed through

I’m not too familiar with that gizmo but my initial suspicion is that you would have to define your own logic and work from there but let me take a look and familiarize myself with it so that I can give you a better answer.

1 Like

@Cedric In this line of code for the angle, is it possible to make it
this.angle += cameraFlipped ? -angle : angle;
where cameraFlipped could be set to true in this block

Otherwise devs won’t be able to tell the actual angle

I think Dave had added this in an older commit but was later removed; I thought this was a good idea.

Thanks again!

image

Created a PR here