Big Gizmo Improvements: Position Screen Space + Rotation Gizmo

I would try to add a dedicated code path in gizmo.ts. SSTransform created in the constructor, parented to the camera depending on a screenSpace boolean optional parameter. At this point, I would experiment with 1 gizmo (axis drag) and see how it goes. Needless to say, all gizmo would be impacted. I don’t know if it’s a lot of work.

Thanks Cedric, I think I have another approach (customizing positionGizmo by adding custom logic inside just for the SS gizmo, which is just another planeDragGizmo), this wouldn’t impact the other gizmos. Will let you know soon!

2 Likes

@Cedric I’m currently working on the rotation gizmo part, where I want it to be like Unity (click anywere inside the rotation gizmo to rotate on multiple axes). I managed to get the algorithm down for the actual rotation!

But what is the best way to detect if a mouse click has happened inside the rotation gizmos? I was thinking of using a ‘virtual sphere’ inside the gizmos and detecting if the ray pick intersects the mesh, but don’t think that’s the best idea, since the gizmos have a fixed size/scale irrespective of world space and camera zooming (updated based on _rootMesh scaling). Unless I bind that sphere as a child of the RotationGizmo._rootMesh.
Or do I check the rotationGizmo.xGizmo.boundingSphere.radiusWorld during onPick?

to me, adding a sphere mesh is a bit overkill. between memory, raycast,…that’s a lot of CPU for (mostly) a 2D distance check. I would try the bounding sphere.
beware, gizmo can be fixed size on screen (default) but there is an option to keep it fixed world sized:

1 Like

Thanks Cedric! Completely agree, no-mesh at all is definitely the more efficient method

All that said :slight_smile: , perhaps a more UI friendly way is to have a visual indicator with a sphere representing the bounds of the overall rotation gizmo mesh!