☑ What’s the difference between world and local?

Hello, What’s the difference between world and local?

I tested this two items but it looks the same.

Thank you !

1 Like

Every entity has a transform. The transform consists of 3 things - position, rotation and scale. A transform and its parts are always relative to another transform. When you say this object is at position (5,2,1) for example it means it is 5 units on the X axis, 2 units on the Y axis and 1 unit on the Z axis away from an origin. That origin can either be the world 0,0,0 point or it can be a different point.

So for your question when you call getPosition for example you are getting the world-space position - which means it’s relative to the global 0,0,0.

If you call getLocalPosition then you are getting the position relative to the Entity’s parent. So if you have a parent at position 1,1,1 and a child at local position 2,2,2 then the world position of the child (getPosition) is at 3,3,3 and the local position of the child (getLocalPosition) is at 2,2,2.

Same concept applies to the rest parts of a transform like rotation and scale.

Hope this makes sense.

1 Like

Wow, it’s exactly as you said.

Thank you so much ! :grinning: