Find the local coordinates of the spot, then just use localToContent.
[code]
–Create a display group, this could have been your sprite
local myObject = display.newGroup();
myObject.x,myObject.y = display.contentWidth/2 , display.contentHeight/2
myObject.bg = display.newRect(myObject,0,0,100,100);
myObject.spot = display.newRect(myObject,0,0,20,20);
myObject.spot:setFillColor(255,0,0);
myObject.spot.x, myObject.spot.y =20,40;
local globalSpotLocation = {}
–calculate global position
globalSpotLocation.x, globalSpotLocation.y = myObject:localToContent(myObject.spot.x,myObject.spot.y);
print("local spot.x before rotation = ",myObject.spot.x)
print("local spot.y before rotation = ",myObject.spot.y)
print("Global spot.x before rotation = ",globalSpotLocation.x)
print("Global spot.y before rotation = ",globalSpotLocation.y)
–rotate the object
myObject.rotation = 45;
–calculate global position
globalSpotLocation.x, globalSpotLocation.y = myObject:localToContent(myObject.spot.x,myObject.spot.y);
print("local spot.x after rotation = ",myObject.spot.x)
print("local spot.y after rotation = ",myObject.spot.y)
print("Global spot.x after rotation = ",globalSpotLocation.x)
print("Global spot.y after rotation = ",globalSpotLocation.y)
[/code] [import]uid: 33608 topic_id: 19251 reply_id: 74303[/import]