Local Space Vs. World Space in Unity

A fundamental concept of game engines that we use all the time.

Let’s start with the definition of coordinate space, it’s a system for describing the position of something. In our case in Unity, it is also used to specify the orientation and scale of objects in our scenes which are the three components of the Transform of a game object.

World space is the position of an object within the Unity scene. When you add an object in the scene you position it in the coordinate space and if you press “reset position” in the Inspector panel you bring it to the center of the scene.

change world position of the parent object

The local space instead is the space of an object with respect to another object. To explain better just take the example of a parent object, if you have an object related to another object above it pressing the “reset position” key you will not go to the center of the scene, but you will be at the center of the parent object. I would always be in the coordinate zero but with reference to a different space.

reset the position of child objects

Through the code, there are methods that allow you to switch from local space to world space and vice versa.

In my case, I used TransformDirection to switch from local space to world space. For all related methods I refer you to the API of Unity

project manager by day, unity developer by night

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

ECESCON 15 years later…

4 Things You Have to Unlearn to Become A Better Programmer

Conduct Powerful Leadership Reviews with Fitbots Printables

How to mix Waterfall and Agile in Project Management: The Envelope Method

That time I coded 90 hours in one week.

How To Quit Being a Coding Impostor!!

A Complete Guide to Deploying Elixir & Phoenix Applications on Kubernetes — Part 5: Clustering…

Modules (alternative way)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Andrea Alicino

Andrea Alicino

project manager by day, unity developer by night

More from Medium

Post Processing Primer for Unity

Unity : Cinemachine and Timeline (Part II)

Modular Stealth Enemy AI in Unity

Platformer: Death Animation