- Home /
how to implement gizmo manipulation
Hi. For the life of me I am unable to find any good information on how to use custom gizmo's to manipulate an object. Basically I have an object with x number of gizmo's being displayed, what I would like to to do is be able to select a gizmo and move it around to manipulate my object based on some custom behavior. In this particular case I am drawing a catmull rom spline and I want to manipulate its shape by dragging the gizmos around.
Thanks!
$$anonymous$$aybe you can try to attach each gizmo to a single empty gameobject which is a child of the Spline. In that way yoou can get the position of the gizmo by using it's transform.position.
Any idea how the scale and move gizmo's are implemented? These have discrete points that can be selected and then used to manipulate the underlying object.
$$anonymous$$h, I don't really know. I should check on the documentation, but right now I'm working on a project, so my time is limited. However, if you look here: http://unity3d.com/support/documentation/ScriptReference/$$anonymous$$onoBehaviour.OnDrawGizmosSelected.html There's written explicitly that "Gizmos are not pickable", so you have to create a gameObject to move them.
I saw that but I also saw this: http://unity3d.com/support/documentation/ScriptReference/$$anonymous$$onoBehaviour.OnDrawGizmos.html which states "gizmos that are also pickable". I am as yet to find any information on the picking however; either that or this text is in error.
Oh, yeah. $$anonymous$$h. I don't know, then. I think you'll have to try that out, then. Sorry if I'm not of too much help, but when I use gizmos is to get some Debug infos, such as radius of areas or stuff like that, so I never really tried with this kind of behaviours. However try to check if you can get the position of a gizmo form a gameObject, because I think it's not possible, but as I said I'm not too good with them.
Answer by Cameron_SM · Dec 04, 2011 at 02:19 PM
This is a case of mistaken terminology. You don't want "Gizmos". Gizmos are just a tab or hot-spot for selecting an object, they're not meant to be interactive.
What you want are Handles and Unity has several classes for rendering/creating custom handles for your objects, see the documentation for further info:
What you want are Handles and Unity has several classes for rendering/creating custom handles for your objects, see the documentation for further info:
Link's broken; it looks like "What you want are" is being added to the URL. The page is here: http://docs.unity3d.com/ScriptReference/Handles.html
Your answer
Follow this Question
Related Questions
Editor Scripting - Override Scaling 1 Answer
Drawing Lines with AA 1 Answer
Drawing a jump distance gizmo 0 Answers
Gizmos not working on Unity 5.0.1p1 0 Answers
How to create a circle Handle/Gizmo with width parameter? 1 Answer