☑ What's the difference between getPosition and getLocalPosition?

Hello, what’s the difference between getPosition and getLocalPosition?

And I tested them :

So, I have no idea what’s the difference between Local and without Local.

Thank you for your time !


The difference becomes apparent when you nest entities. For example, pretend you have a Parent entity, and you place a Child entity within it.

- parent
    - child

Now, say you move the parent entity 1 point along the z axis as follows:
parent.entity.setPosition(0, 0, 1);

This moves the child entity as well.

child.entity.getPosition().toString(); // Outputs 0, 0, 1
child.entity.getLocalPosition().toString(); // Outputs 0, 0, 0

Globally, the child was moved 1 point, while locally (relative to its direct parent) it’s still at 0, 0, 0.