Hello.
My game widely uses changing of game world reference point with rotation around it. And I can not beat the bug I found. It seems to be a bug in Corona basic geometry routine.May be I miss something. Have anybody same problem?
Here is a test code I submitted as bug report
-- Rotation bug demonstration:
-- Programm shows a "world" group rotating around its reference point
-- User can change the center of rotation, touching the screen.
-- After touch world must become rotating around the point which user tap,
-- but instead, this point is shifted with the entire world
-- and resulting rotation center is not located under the finger as it have to be
-- create world group:
local world = display.newGroup()
-- creating world "background"
local bkg = display.newRect( 0, 0, 200, 200 )
bkg:setFillColor( 50, 50, 50 )
-- creating marker of the world reference point
local w\_ref = display.newRect( 0, 0, 5, 5 )
world:insert( bkg )
world:insert( w\_ref )
-- set reference marker to world reference point
world.xReference, world.yReference = 100, 100
w\_ref.x, w\_ref.y = world.xReference, world.yReference
--------------------------------------------------------------------------------
-- timestep() makes world rotating with given speed
local function timestep(event)
world:rotate( 0.3 )
-- note: if comment rotation above, object will not jump when changing world reference point
end
--------------------------------------------------------------------------------
-- setRotationCenter() allows user to change the center of rotation
local function setRotationCenter( event )
if event.phase == "began" then
world.xReference, world.yReference = world:contentToLocal( event.x, event.y )
-- note: if you uncomment next line, it will fix the bug:
-- world.x, world.y = event.x, event.y
w\_ref.x, w\_ref.y = world.xReference, world.yReference
end
end
-- add listeners:
Runtime:addEventListener("enterFrame",timestep)
Runtime:addEventListener( "touch", setRotationCenter )
My game is totally frosen with this issue, and the solution which I found for this does not help with more complex multitouch contol which I use in game.
Thanks for your attention,
Alex Lysenko [import]uid: 66525 topic_id: 14865 reply_id: 314865[/import]