Search Unity

Runtime Translate/Rotation/Scale Gizmo

Discussion in 'Works In Progress - Archive' started by tpelham42, Jan 12, 2012.

  1. tpelham42

    tpelham42

    Joined:
    Apr 15, 2008
    Posts:
    119
    Hello,

    After spending some time searching for a run time object control gizmo I couldn't find what I was looking for. As part of my main project I ended up writing one from scratch. I'm thinking about uploading it to the Asset Store, but wanted to get some feedback on whether or not this is something others may want.



    After some feedback I've updated the Webplayer demo with new features. I hope to have it up in the Webstore within a few days.

    Gizmo Controller Demo
    WebPlayer Demo


    Features
    - Position, rotation and scale gizmo control
    - Uses plane projection for accurate and smooth interaction
    - Includes a 3D gizmo model (Can be replaced with your own)
    - Includes custom gizmo shader
    - Includes axis handles for x, y, z, xy, xz and yz
    - Snapping options with configurable snap increments for all modes
    - Keyboard shortcuts for switching between modes and snapping(Can be disabled)
    - Gizmo control window for switching modes, manual value input and snap settings (Can be disabled)
    - Included functions for controlling the gizmo settings from another script should you want to replace the built in gizmo control window
    - Included with RTGizmo is the GUISpinner object class which is is used in the gizmo control window for manual input. The GUISpinner object has built in functionality for right click to reset value as well a click timer on the plus/minus buttons. This means that if you hold down the plus or minus button for a moment it will start going up automatically instead of clicking repeatedly to increment the value.

    Thanks! Look forward to your feedback.
     
    Last edited: Jan 16, 2012
  2. Gorlog

    Gorlog

    Joined:
    Jan 20, 2011
    Posts:
    201
    nice one ! thats a usefull stuff keep it up
     
  3. tpelham42

    tpelham42

    Joined:
    Apr 15, 2008
    Posts:
    119
    Thanks! I hope to have it ready for the Asset Store within a few days.
     
  4. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,953
    Instead of putting it on the Asset Store, please just release it for free as a .ZIP. I'm very interested, because one of our projects may utilize a level/mission editor, and I don't want everything on the project's root directory, as that's just annoying. I want to put stuff where I want it on my disc.

    Cool. Think I'll play the web player again.
     
  5. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
    Nice work in general but I have a little suggestion/request: please, add plan movement (xy, xz, zy)

    Maybe I have found a bug: scaling system seems not work with snap enabled.

    Bye
    Kenshin
     
  6. tpelham42

    tpelham42

    Joined:
    Apr 15, 2008
    Posts:
    119
    I usually import packages from the asset store in to a new fresh project to see how it all works and then manually pull over the files that are needed in to my main project.
     
  7. tpelham42

    tpelham42

    Joined:
    Apr 15, 2008
    Posts:
    119
    Thanks for the feedback. I haven't had any issues with the scale snapping, but it can take a bit more mouse drag to get it going. I'll have to add in a separate sensitivity setting for that. I definitely like the idea of the xy/xz/zy axis control and will look in to adding that before putting it up on the asset store.
     
  8. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
    Thanks! :)
     
  9. punkvideo

    punkvideo

    Joined:
    Jan 13, 2012
    Posts:
    89
    Cool! were download it?
     
  10. tpelham42

    tpelham42

    Joined:
    Apr 15, 2008
    Posts:
    119
    Done. I updated the webplayer demo with the new XY, XZ and YZ controls as well as added a scale snap multiplier setting so it should be a bit smoother now. Let me know what you think.
     
  11. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
    Good update... now it works better.

    I have found another little bug:
    1) I move the object far away from the camera and I release mouse button
    2) I click on the secont object
    3) I click on the first one
    BUG: Gizmo appear but if I click on every gizmo element the object don't move

    Bye

    Kenshin
     
  12. tpelham42

    tpelham42

    Joined:
    Apr 15, 2008
    Posts:
    119
    Thanks for the feedback. You've been a great help on getting this tweaked up. I found the distance issue and will be fixed up before release. Thanks again!
     
  13. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,953
    Ehh... yeah, but that takes too long. For me, convenience is key. I'm a bit lazy in that aspect.
     
  14. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,953
    Oh, and if you set the snap mode to zero and try to move, the object vanishes.
     
  15. tpelham42

    tpelham42

    Joined:
    Apr 15, 2008
    Posts:
    119
    Nice find. That'll get fixed up. Thanks.
     
  16. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,953
    You're welcome.
     
  17. tpelham42

    tpelham42

    Joined:
    Apr 15, 2008
    Posts:
    119
    Gizmo approved in the Unity Asset Store. More info.
     
  18. Modulus

    Modulus

    Joined:
    Jan 11, 2012
    Posts:
    6
    Hi, I'm new to unity, does this work with rigid bodies as well?

    Regards,

    Modulus
     
  19. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,953
    That would depend largely upon how it's coded. If all it does is manipulate the object's transform vector, then it should work on Rigidbodies. The proviso would be that you'd to take special precautions because Rigidbodies are updated every frame to match the gravity and other forces effecting them, which would effect those coordinates, so the object wouldn't go where you wanted it to.

    One potential solution would be to disable the Rigidbody component while you're moving it at runtime with the gizmo. Then when you select some other object you can re-enable it. That's how I'd do it.
     
  20. tpelham42

    tpelham42

    Joined:
    Apr 15, 2008
    Posts:
    119
    The RTGizmo simply translates a game objects transform, but as SevenBits said it may not work as you would expect due to additional forces on the rigidbody. Disabling and re-enabling the objects rigidbody as suggested should work just fine. You would disable the RigidBody before setting the selectedobject of the RTGizmo controller. Also check if there is already a selected object and re-enable the RigidBody before selecting another object.

    Hope that helps.
     
  21. polphit

    polphit

    Joined:
    Aug 28, 2013
    Posts:
    1
    Hi,
    I would like to make simple model editor with 4 views (perspective, top, front, and side) using 4 cameras.
    The four cameras spans viewport of (0,0)-(0.5,0.5), (0.5,0)-(1.0,0.5), ... (like 3DS MAX).

    1) Should I add 'Mouse Orbit' to all cameras? I get 'SendMessage setEnabled has no receiver!' at line 428 of GizmoControllerCS.cs. If I add 'Mouse Orbit' and disabled, it works without error.
    2) For the orthographic camera, Top View (camera is at (0, 5, 0) rotated by (90, 0, 0) and sees an object at (0, 0, 0)), I can move the object along blue axis (z) but I cannot move the object along red axis (x).
    3) For the orthographic camera, in some cases, the gizmo is very tiny and also its size varies if I move the object along an axis. It is not always easy to reproduce.

    Thank you.