Search Unity

Rotating gizmo issue

Discussion in 'Scripting' started by Dor770, Mar 26, 2016.

  1. Dor770

    Dor770

    Joined:
    May 25, 2015
    Posts:
    7
    help - I made an external tool for editing the sceane in editor mode, and I can't rotate the gizmo that reprisent the place where the change is about to hapend..
    When I use the Gizmos.DrawWireCube , i there is no parameter for rotation.....???
    I have serched and came empty handed....
     
  2. Helix_Snake

    Helix_Snake

    Joined:
    Feb 23, 2016
    Posts:
    13
    I don't think there's a way to rotate wire cube gizmos, but you can write a function that draws a rotated cube. Just make a function that takes the height, width, depths, position, and rotation of the cube. Make an array of eight Vector3s to compose the points of the cube before they're transformed. They should be:
    (0.5, 0.5, 0.5)
    (0.5, 0.5, -0.5)
    (0.5, -0.5, 0.5)
    (0.5, -0.5, -0.5)
    (-0.5, 0.5, 0.5)
    (-0.5, 0.5, -0.5)
    (-0.5, -0.5, 0.5)
    (-0.5, -0.5, -0.5)

    Then make a transform whose position is the position, whose rotation is the rotation, and whose scale is (width, height, depth), use that transform's TransformPoint function to transform all of those points (remember, TransformPoint doesn't actually change the value, you have to set the variable equal to the result of the TransformPoint function), and then use 12 instances of Gizmos.DrawLine to draw the cube's edges.
     
  3. Dor770

    Dor770

    Joined:
    May 25, 2015
    Posts:
    7
    (forgive my terrible spelling ;) dude... this is so redundent... why limit the gizmoes like that?... for efishency?.... i've seen a guy lecturing on youtube and using gizmos freelly like all objects to control his stuff.... i cannot exept that he had to drow all the difrent shapes using only streit lines...
    thow i do appritioate the help :) and it is a solution for my problem..... I gust really nead a better wey. theas guys a friken guinieses...
    thanks :)