- Home /
Move Objects Relative in Viewport
Hi,
how can I do relative movement in the editor window? Say I want to move an object or multiple ones 5 units along X. Seems like the Inspector only allows absolute inputs.
Keep in mind I'm not asking about scripting here, but just about some simple relative translation in the viewport.
Thanks a lot!
Answer by getyour411 · Mar 13, 2014 at 10:42 PM
You should have taken the time to explain yourself better at first, your initial problem description is poorly written.
Select the object(s) by clicking left-click and shift, enter 5 in Y
That does not work. It mere puts all selected objects at Y-position 5. That's not what I want. I want to offset each object 5 units away from their current position.
Sorry if this was poorly written, but relative transform is such an ubiquitous term in 3D, I didn't know I would have to explain it clearer, e.g. with an example. $$anonymous$$y apologies.
With your objects selected, click and hold on the "Y" letter and drag mouse to the right
Click and hold the 3D transform widget up arrow; tested it this time, was surprised to see my test cubes on the 'Y' drag method all synch to uniform height (missed that) but this method worked fine.
Answer by rutter · Mar 14, 2014 at 01:30 AM
Not the prettiest workaround, but it'll do:
Create an empty GameObject at (0,0,0). We'll call it "temp".
Change hierarchy: every object you want to move should become a child of temp.
Move temp to (0,5,0).
Change hierarchy: restore original parent for every object you moved.
Delete temp.
If you need to do this often, I'd honestly probably just create a quick and dirty editor script for it.
I thought about that,too, but I can't pull these objects out of their hierarchy. It would be an organisational mess.
In the meantime I wrote a script which does the relative positioning. I still can't believe I had to write code to accomplish this.
Answer by JuanseCoello · Mar 13, 2014 at 09:53 PM
I dont really understand what you are trying to do, what do you mean by relative, be more specific, I can help you, but try to explain me like in kindergarden with examples, I am working in a videogame and I have done things like that, but I am not sure what you mean, and also I speak spanish. Ans try to post your script, with details of your game so I can help you please.
I think you mean moving the object in the editor. It is very simple. You have to select your object in the hierarchy window. Then at the left there is the inspector window. There is the option transform, look at position and type 5 in the axis you want in this case x, 5 it means 5 meters, depending on how much you consider unit, you can put decimals, like 0.005 but if you want to make calculations use a calculator. I guess one unit in unity is 0.0001 that is the slowest unit you can have to move. I dont understand why this is difficult. If you explain more maybe I can help you.
Hi Juanse. I am not talking about scripting!
Here is what I want to do:
I have several objects scattered across the scene. I want to move all of these objects 5 units along the Y-axis. How can I do that in the Inspector or with the Transform gizmo? NOT via scripting!
And I don't want to use a calculator for all these objects! I just want to input a position offset. Quick and easy.
Thanks.
Put in other words: I want to move these objects ALL AT ONCE 5 units along Y. I don't want to select one object after the other and add 5 to their current position.
Good god, this is super basic functionality in EVERY 3D app out there since the birth of 3D. Only Unity doesn't have this or hides it undiscoverably.
Your answer
Follow this Question
Related Questions
Vector-based movement? 1 Answer
Relative position? 1 Answer
How to fly in Controller's forward direction? 1 Answer
Axis/Gizmo Translation Movement 0 Answers