I need to get the x and y coordinates of the presentation object of a specific agent that lives inside another agent.
See the example below.
The rectangle is inside the object called page. And after placing the agent 'Page' on the main agent I moved the presentation object that was created to a new location.
I now need to be able to find the correct location of where the presentation object was moved to so that I can use it in the code.
I tried using
page.getX();
page.presentation.getX();
But both just return zero
Is there a way to get hold of the presentation object of an agent by only having access to the agent reference?
When you place an agent in another one's markup space, its animation gets attached to origin by default. It's important to set "at the agent animation location" option as initial location of page agent (see it's properties). If the specified offset (130; 110) above is a rectangle offset inside page agent exactly, do not forget to additionally take into account this rectangle position there:
page.getX()+page.rectangle.getX()
If you desire to get location of rectangle on main agent from inside Page agent, you need to use the construction like below, i.e. take into account both page agent location and relative rectangle location inside page agent:
getX() + rectangle.getX()