I am attempting to add objects to a group that is in the middle of rotating and it works, but the x and y coordinates are completely off.
For example, I am trying to append to a line by touching on the screen. It gets the new x/y coordinates and appends them successfully, but I think since the object is rotating it adds them relative to the rotation when I really want it added at the real x/y coordinates.
Hope that makes sense. Here’s a bit of code as an example:
Capturing the event:
[blockcode]
if “began” == phase then
– Make target the top-most object
local pt = {}
pt.x = event.x;
pt.y = event.y;
table.insert(linePoints,pt);
end
[/blockcode]
Adding the line:
[blockcode]
line = display.newLine(linePoints[1].x,linePoints[1].y,linePoints[2].x,linePoints[2].y);
for i = 3, #linePoints, 1 do
line:append(linePoints[i].x,linePoints[i].y);
end
[/blockcode]
Rotating the line, called every .25 seconds:
[blockcode]
local function rotateCanvas (event )
if (line ~= nil and line.rotate) then
line:rotate(-3)
end
end
[/blockcode] [import]uid: 84258 topic_id: 15525 reply_id: 315525[/import]