Game Development How to Make a Video Game The Unity Editor and Scene Setup Place Assets in the Scene View

Ranvir Sahota
Ranvir Sahota
9,844 Points

Global Space vs Local Space

Revisiting course to ensure my I grasp the basics and I don't. What I understand so far of local and global space is they relative to some point. So Global is relative to some point on the map mostly likely the centre? Each game object has local space that sets everything relative to itself? I have trouble understanding the purpose of them. What I understand of purpose Global space is to position an object in the world, is that correct? But then why use local space? Why do you need to move an object on its own axis, when everything is relative to it? Am I missing something or over complicating this? Plz, help!

4 Answers

Jake Kemper
STAFF
Jake Kemper
Treehouse Staff

Ranvir...let me know if this helps.

The local space is defined relative the object The world space is relative to the world: The origin is the center of the world

Imagine you're in a seat on ship . You have a position and rotation relative to in the ship. You're in the chair facing forward. BUT, as the ship travels around, and turns, goes up and down, left right..... your position on the world is changing, as well as your cardinal facing direction, but your position within ship is not.

If you put a GameObject in another, and then move the parent GameObject around, the child GameObject moves with it. Like a person in a ship or a sword whose local position is in a characters hand.....but the character is moving in relationship to the world.

It's local position is that inside its parent, where as the global is its position in the World.

Ranvir Sahota
Ranvir Sahota
9,844 Points

Thank you, Jake, you explained this perfectly!

Nick Manring
Nick Manring
10,882 Points

TL;DR - I just want to note this for future students... It seems Unity uses LOCAL as the default setting for position/rotation transform, so at the part of the instruction where Nick talks about changing position in the Scene view with the cube-looking icon and that one of the three axes will lock while manipulating the object, it will not do this as demonstrated in the video. LOCAL must be changed to GLOBAL for this to work (keyboard shortcut = x).

LONG VERSION When I downloaded and ran Unity for the first time (on July 8, 2017), as instructed in this course, and got to the part about using the position transform controls, I tried to move Rock10 as Nick did in the video but my axes values all fluctuated wildly... it turns out LOCAL is the default setting. So when Nick demonstrated grabbing the "box sides" (not the arrow controls - sorry, can't remember what he called them) which would lock one axis while positioning in the scene view, I got a little confused thinking I was doing something wrong.

... it was only one of the following videos where he explained Local vs. Global that I realized what the problem was. I realize it may be difficult to edit this video to correct so I just wanted to write this to help anyone thinking they were doing something wrong. You are not! Just be patient and try this technique again once GLOBAL is toggled on.

I hope this helps anyone who was confused like me.

The lessons are working for me beautifully otherwise though! Thanks Nick and the rest of the TreeHouse team for great instructional videos as usual!

-The other Nick

Matthew Musni
Matthew Musni
610 Points

from my understanding, you can use the local space when you want to move an object according to its angle. thus, its use is dependable in the situation you are in.

Ranvir Sahota
Ranvir Sahota
9,844 Points

Yh I still don't understand. It's hard to explain it I'll send this post treehouse support hopefully teacher/dev/moderator will be able to answer my question. Thanks for trying