Create a gizmo

Hi, I made a software with an editor and I want to add a gizmo for object’s manipulations.

So, when an object is selected, I add some meshes in the scene in order to create my gizmo. Then I can use them to move my selected object. So far, everything is fine.

I just have one last problem. When I come closer to my selected object, my gizmo is very big. And when I go further from my selected object, my gizmo is really small. That’s the normal behaviour for 3D objects. But unfortunately it’s not what I want for my gizmo. I want it to keep the same screen size and still be able to rotate around or move it. In fact I want the same behaviour than gizmo in maya or 3DSMax.

Is there a way for my gizmo to keep always the same size ? By same size, I mean it’s onscreen representation.

Thanks in advance.

You can create a task that changes the scale on your gizmo based on the distance from the camera, to compensate for the perspective changes. You’ll have to calculate what the scale ought to be to keep it visually the same; my guess is that this calculation would involve diving by the relative Z value from the camera.

David

Thanks, that did the trick.

I hate to resurrect a dead thread, but I’m trying to do the same thing and I’m running into a problem. Doing the above works, but when moving the camera to and from the gizmo quickly the gizmo jitters, as if it’s not evaluating the new scale every frame.

Is this something I can work around or do I have to bite this bullet? The jittering while the scale is set looks a bit wrong…