please test my code.
run it with and without line 31 to see different.
it seem like localToContent() function make change obj xReferent,yReferent.
please test my code.
run it with and without line 31 to see different.
it seem like localToContent() function make change obj xReferent,yReferent.
I don’t think you are going to get a very positive response if you just dump a link to some code without explaining your problem.
I’ve just compiled your code, it works fine.
Here is consolidated version of the code showing what happens
local g = display.newGroup() display.newRect(g, 0, 0, 100, 50) g.xReference, g.yReference = 50, 25 g.x, g.y = 100, 100 g.rotation = 60 -- everything is OK if no rotation involved g:localToContent(0, 0) -- comment/uncomment changes position on screen g.xReference, g.yReference = 75, 25 -- setting different ref point after calling localToContent causes the effect g.x, g.y = 100, 100 local point = display.newCircle(0, 0, 5) point.x, point.y = 100, 100 point:setFillColor(225, 0, 0)
Generally speaking you should be using :localToContent() to return numbers; it converts local position into stage (screen) position. By not calling it I suppose it could be changing reference or somehow adjusting the object itself.
What do you need to use the command for?
But I need localToContent() function to get some calculate. I need a loop : set positon - calculation. so that become worng from second loop. I can’t set position exactly -> can’t calculation.
Thanks Lerg for make it code smaller.
I don’t think you are going to get a very positive response if you just dump a link to some code without explaining your problem.
I’ve just compiled your code, it works fine.
Here is consolidated version of the code showing what happens
local g = display.newGroup() display.newRect(g, 0, 0, 100, 50) g.xReference, g.yReference = 50, 25 g.x, g.y = 100, 100 g.rotation = 60 -- everything is OK if no rotation involved g:localToContent(0, 0) -- comment/uncomment changes position on screen g.xReference, g.yReference = 75, 25 -- setting different ref point after calling localToContent causes the effect g.x, g.y = 100, 100 local point = display.newCircle(0, 0, 5) point.x, point.y = 100, 100 point:setFillColor(225, 0, 0)
Generally speaking you should be using :localToContent() to return numbers; it converts local position into stage (screen) position. By not calling it I suppose it could be changing reference or somehow adjusting the object itself.
What do you need to use the command for?
But I need localToContent() function to get some calculate. I need a loop : set positon - calculation. so that become worng from second loop. I can’t set position exactly -> can’t calculation.
Thanks Lerg for make it code smaller.