I have created a newSnapshot with an image object added to the group. The localToContent code correctly displays the X,Y of the SmallCircle in relation to the screen:
local screenWidth = display.actualContentWidth local screenHeight = display.actualContentHeight local backgroundGraphic = display.newImageRect( "backgroundGraphic",360,2378) snapshot = display.newSnapshot( screenWidth \* 2 , screenHeight \* 2 ) snapshotGroup = snapshot.group snapshotGroup:insert( backgroundGraphic ) --add SmallCircle to snapshop group SmallCircle= display.newImage( "SmallCircle.png") snapshotGroup:insert( SmallCircle ) --Determine Screen Coordinates of SmallCircle (Returns correct screen coordinates) local sqCenterX1, sqCenterY1 = SmallCircle:localToContent( 0, 0 )
If I apply Quadrilateral Distortion on the snapshot, the localToContent code does not display the correct X,Y coordinates of the Small Circle.
--Quadrilateral Distortion w = screenWidth \* .45 h = screenHeight \* .45 snapshot.path.x1 = w snapshot.path.y1 = h snapshot.path.x2 = -w snapshot.path.y2 = -h snapshot.path.x3 = w snapshot.path.y3 = -h snapshot.path.x4 = -w snapshot.path.y4 = h snapshot:invalidate() --Determine Screen Coordinates of SmallCircle (Incorrect coordinates returned) local sqCenterX1, sqCenterY1 = SmallCircle:localToContent( 0, 0 ) --Incorrectly returns the same x,y screen coordinates of the smallcircle without quad distortion. The distortion should change the coordinates as the small circle graphic in relation to the screen.
Can anyone suggest how to use localToContent to get accurate screen coordinates on a distorted group?
I’ve read in other posts related to Mode7 that I need to perform a 3D transform to calculate the z-depth…but I don’t know how.
Thanks in advance.