Page 1 of 1

How to get the exact position point of an entity?

Posted: Tue Oct 15, 2013 3:08 pm
by alex_king92
I'm using an isometric map and I need to know the exact point where an entity is (not isometric tile), especially while it's moving. Which attribute of my entity must I get?

Re: How to get the exact position point of an entity?

Posted: Tue Oct 15, 2013 5:21 pm
by alex_king92
Sorry, solved.
If anybody other has the same question, the answer is:

Code: Select all

var wordPos = entity.worldPosition();
It's explained in .../ige-master/documentation/root/IgeEntity.html

Re: How to get the exact position point of an entity?

Posted: Sun Oct 20, 2013 5:55 pm
by coolbloke1324
Also you can use:

entity.translate().x()

To get and set the x co-ordinate (same for y and z) and also

entity.rotate().z()

and

entity.scale().x()

You can also access the translate, rotate and scale data via:

entity._translate
entity._rotate
entity._scale

However worldPosition() will also take into account parent transforms whereas the above data is local to the parent.

Re: How to get the exact position point of an entity?

Posted: Sun Oct 20, 2013 5:59 pm
by robaldred
it might also be worth mentioning

Code: Select all

entity.screenPosition()
This is a position relative to the browser viewport, I've found it useful placing DOM elements