How to deign a gizmo like the gizmo in 3ds max

Started by
3 comments, last by andur 15 years, 9 months ago
How to deign a gizmo like the gizmo in 3ds max? I want to design a gizmo for moving a 3d object in mapeditor.
akira32 編程之家 Yahoohttp://tw.myblog.yahoo.com/akira32-akira32
Advertisement
What is the gizmo in 3ds max? What does it look like? What is it's function?
in max a gizmo is some kind of a helper object-a cube, sphere and another shape (it can be used to make a volume fog effect in that shape,...). I think he wants to make some kind of a dummy object to position stuff
The 'Gizmo' is the tri-cursor tied to the centre of the currently selected object (mesh, face, vertex, whatever). Drag the mouse over one of its axis pointers to restrain movement/scale/rotation on that axis.

See the 3 arrows on the tip of the nose:



To make one, I'd start by grabbing the forward, right and up vectors of the currently selected object, normalising then, then drawing coloured lines from the centre to:

Position.Translate(ForwardVector.Normalised() * Length)

If the above makes sense. Sorry I'm no DirectX/XNA user. Next, add coloured triangles to the tip.

"The right, man, in the wrong, place, can make all the dif-fer-rence in the world..." - GMan, Half-Life 2

A blog of my SEGA Megadrive development adventures: http://www.bigevilcorporation.co.uk

It should be fairly straight forward to do.

Start off by creating yourself a model of the gizmo, just like any other mesh. The mesh should be built with the arrows aligned to the axis, and with its origin at (0,0,0) for ease of positioning it.

Then, when you select a mesh, draw that gizmo centered on the mesh's pivot point or on the center of the mesh itself (position it however you like).

Then, whenever you process mouse input into the scene, test against the gizmo mesh first, and if the user clicks on it, and starts dragging it, then move the mesh itself accordingly. There's a little bit of math involved with this, look for tutorials on mesh picking if you aren't familiar with how to do it.

Same type of deal goes for the rotation and scaling gizmos.

This topic is closed to new replies.

Advertisement