world title 

This is a very quick article to discuss the difference between movement in local and world space and how to script moving objects in both.

World Space Vs Local Space.
The easiest way to describe the difference between world and local space is that in world space the Y axis is always pointing upwards but in local space the Y axis is relative to the rotation of the object. It may be easier to understand with a few visual examples.

In this first example both the local space and world space are aligned so that in both cases the Y axis is pointing straight up.


However if we rotate the game object you will see that the world and local space is no longer aligned. This is because local space is relative to the game object not the game world.



Moving Game Objects in World Space.
So how do we code to use world space instead of local space? Below we will look at transform.Translate & transform.Rotate in world space and local space.
transform.Rotate(); is the most common form of command where World Space will be needed. The parameters required for transform.Rotate are how much you wish to rotate the object in the x,y & z axis. eg. transform.Rotate(0,1,0); However it does have an extra parameter which if not added is set to local space by transform.Rotate(0,1,0,Space.Self); we can therefore change the Space.Self to Space.World to have it rotate around world space instead. The example below rotate the object around the Y axis in world space.


This method also works for transform.Translate when moving an object. The example below will move the game object in a diagonal motion in world space.


Links to Unity API documentation:

Casino Bet 365 is best casino in the world.

What's Next

Next up for Unity Snippets is a look at game development articles from across the web...

Free Templates -
Popular Art Betting make bookies articles.