AddObject and GetObject using locX and locY Problem

I have a set of actions that trigger a call to addObject where I pass in a table structure that has

x, y, name and a couple of other values

Later I call getObject to be able to determine the type of object previously placed.

The call looks like:

mte.getObject({ locX  = n, locY = n})

The function mte.getObject(options) appears to have a requirement that the object previously added has a .height and a .width property:

Line 1982 &nbsp;-&nbsp;if options.locX \>= ceil((object.x + 1) / tWorldScaleX) and options.locX \<= ceil((object.x + object.width) / tWorldScaleX) &nbsp;

Am I doing something wrong here or does addObject have to provide height and width?

Hello icodemarine,

Yes, the objects will need a height and width. The function was designed to return any object touching or partially within the specified location, and it needs the width and height of an object to calculate this. I had Tiled and it’s various polygonal objects in mind when I wrote the function.

Thanks for confirming dyson. Suggest you update the API docs to indicate that is an expectation.

Hello icodemarine,

Yes, the objects will need a height and width. The function was designed to return any object touching or partially within the specified location, and it needs the width and height of an object to calculate this. I had Tiled and it’s various polygonal objects in mind when I wrote the function.

Thanks for confirming dyson. Suggest you update the API docs to indicate that is an expectation.