|
i would like to create gizmos like movement gizmos of the editor at runtime. i want to know how can i implement one for the runtime? i would be more than happy if the real implementer of editor handles answer me and tell me what to do.
(comments are locked)
|
|
Here is my Gizmo solution in action.
This is a full working gizmos and you are able to change Feel free to download the source code and if you have any question drop a line in the comments. @Cyclops it's easier than you think.. the whole thing is not taking more than an hour from scratch.. :)
Mar 17 '10 at 05:37 PM
Lipis
@Lipis, maybe easy for you, but I always seem to do things the hard way... :)
Mar 17 '10 at 05:48 PM
Cyclops
If it's complicated it's wrong...!! :)
Mar 17 '10 at 06:01 PM
Lipis
(comments are locked)
|
|
Well, I have written a basic implementation of a faked run-time version of a three-axis Location Gizmo that allows you to - click on an axis to move an object along the chosen axis (try saying that three times fast...) Turned out to be a lot harder than I expected when I started - I thought, "okay, first I need to draw three orthogonal lines", and things went down-hill from there. Who knew drawing a line was that hard? :) What I wound up doing was creating a Procedural Mesh (and there was another learning curve) of an arrow, in triplicate, attach a red/blue/green material to it, and rotate each as needed. Then attach a mouse-down script to each axis, that moves both the Gizmo object and its Parent object as long as the mouse is held down. It's not a true mouse-drag, which would have been a lot more work, and this was plenty as it is. All of this is done procedurally - it requires three scripts, one of which, s_GizmoCreate.cs, you drag/drop to a Hierarchy object. When the game starts, the script creates the Gizmo onto the object. You could also build it into a GUI, such that the script is attached to an object you clicked on - but again, that's another metric ton of work. :) As I said, this is a basic implementation of a single Gizmo type (specifically the 3-axis Move Gizmo). But it demonstrates all the programming techniques that you would use for others, such as the Rotation Gizmo. I've put a complete sample package, with the three scripts needed, on the Unify Wiki at: thank you for the great work
Mar 15 '10 at 06:34 AM
Ashkan_gc
i have some questions about meshes and FBX files man. can you email me at ashkan_gc(at)yahoo(dot)com?
Mar 15 '10 at 07:17 AM
Ashkan_gc
Glad you liked it. Enough to check the Bounty box/checkbox? :) While I realize it's crude - it was only intended as proof-of-concept and to demo the techniques. If you want a full, professional implementation, then we're talking hourly rates. :)
Mar 15 '10 at 02:11 PM
Cyclops
(comments are locked)
|
|
Here's a start, by using the GL.LINES mode with immediate drawing during the OnPostRender() function, you are able to draw the handles. I've got as far as the actual lines drawing, however not the ability to select them. Something tells me that will require a lot more code. Place this script onto your camera, then drag the target for the handle into the target slot. This also handles local and global direction handles with a drop down on the script, and you can change the length of the handles with the handleLength variable.
From here you should get a good idea on how to draw lines in the same fashion handles are drawn, but in runtime. If you want to try and draw the cones on the end, use GL.Begin(GL.TRIANGLES) and send three vertex3 calls through at a time. You may need to do some matrix maths to get them looking right however. Isn't GL.Lines, a Pro-only feature?
Mar 17 '10 at 01:39 PM
Cyclops
You are correct, sorry I tend to not notice those notices (Pro user here).
Mar 18 '10 at 03:21 AM
Murcho
(comments are locked)
|
|
@ Murcho I really like your solution by using the GL.LINES. I have a scene where I have 3 objects and I would like to display theires axes by GL.LINES. The probleme is that the GL.LINES system is on my camera, where I can add one Target. How can I use this system with several Target ? Thanks for your help.
(comments are locked)
|
|
Short Answer: Unfortunately, you can't. Long Answer: The Handles class which is used to create movement/scale/rotation handles is an Editor class, which means you can only use it within editor scripts, not at runtime. There is no runtime equivalent, and as far as I know, there is no way to use editor classes at runtime. If you really HAVE to have this functionality, you would have to write your own implementation. i know that man. i want to implement one myself. i told this in my question.
Mar 07 '10 at 06:28 AM
Ashkan_gc
i wrote in my question that i want to implement one.
Mar 15 '10 at 06:37 AM
Ashkan_gc
(comments are locked)
|


@Ashkan just leave the question open til the deadline.. you might have another cool answer.. this is a good one :) Let's see..
I'm reluctantly forced to agree. :) Just don't let it expire. Plus, I can't wait to see Lipis's answer, I'm sure it's almost done. :)
@Cyclops.. hehe..! actually I wasn't about to implementing it.. but since I got some ideas.. let's see.. :)