physic behavior between sdk 840 and sdk 894 ....

Without changing anything my code just doesn’t do the same (it’s the first time for the last 2 years that I use Corona that such a thing happens).

Maybe it’s a bug related to 2.2.1 box2d update…

Here is a sample code and the issue explained in the comment :

-----------------------------------------------------------------------------------------  
-- main.lua  
-----------------------------------------------------------------------------------------  
  
-- hide the status bar  
display.setStatusBar( display.HiddenStatusBar )  
  
-- setup :  
local physics = require "physics"  
physics.start()  
physics.setGravity( 0, 0 )  
physics.setDrawMode( "hybrid" )  
   
local function getPositions( x, y, angle, distance )  
 local mPi = math.pi;local mCos = math.cos;local mSin=math.sin; local mCeil=math.ceil  
 return { mCeil(x + (distance \* mCos((angle-90) \* mPi / 180))), mCeil(y + (distance \* mSin((angle-90) \* mPi / 180))) }  
end  
  
local indices={}  
   
-- 1 the center :  
local center = display.newCircle( 160, 240, 5 )  
center:setFillColor(200,0,0,255)  
-- physics for rotation  
physics.addBody( center, "static", { radius=5 })  
   
-- 2 the rectangles :  
local function doObject( angle, distance)  
 -- the object :  
 local object=display.newRect( 0, 0, 5, 30 )  
 object:setFillColor(200,0,200,255)   
 -- place the object  
 indices = getPositions( 160, 240, angle, distance )   
 object:translate( indices[1], indices[2] )  
 object:rotate(angle)  
 -- physics for rotation  
 physics.addBody( object, "dynamic", { isSensor = true, radius=5 } )   
 physics.newJoint( "pivot", object, center, 160, 240 )  
 return object  
end  
   
local objects={}  
for i=1, 5 do  
 objects[i]=doObject(math.random(360), 150)  
end  
   
-- 3 the rotation :  
local function mainloop( event )  
 for i=1,#objects do  
 objects[i]:rotate(10)  
  
 -- HERE IS THE BUG  
 -- in sdk 840, the speed is about 1 turn in 2 seconds  
 --\> in sdk 894, the speed is QUITE SLOWER !!!  
 -- trying to catch up the speed by increasing rotate(50)  
 -- increases A LOT the aiming poblem (rectangles are not aiming at the center dot)  
  
  
 end   
end  
  
-- pause :  
local text = display.newText( "PAUSE", 0, 0, native.systemFont, 30 )  
text.x = 160  
text.y = 460  
text:setTextColor( 255,110,110 )  
local isPause=false  
local function pause( event )  
  
 if event.phase == "began" then  
  
 if isPause==false then  
 Runtime:removeEventListener("enterFrame", mainloop)  
 isPause=true  
 text.text="PAUSE"  
 else  
 Runtime:addEventListener("enterFrame", mainloop)  
 isPause=false  
 text.text="RUNNING"  
  
 end  
  
 end  
  
end  
   
text:addEventListener("touch",pause)  

Thx [import]uid: 9328 topic_id: 30607 reply_id: 330607[/import]

I has a similar problem yesterday with one of my apps that’s using physics. I was on build 821 and i do a couple of gravity changes in the code.

in build 821 all the gravity was working as expected.

in build 894 all of my objects were ignoring any gravity changes.

I just reverted back to build 821 for now. [import]uid: 88147 topic_id: 30607 reply_id: 122654[/import]

I has a similar problem yesterday with one of my apps that’s using physics. I was on build 821 and i do a couple of gravity changes in the code.

in build 821 all the gravity was working as expected.

in build 894 all of my objects were ignoring any gravity changes.

I just reverted back to build 821 for now. [import]uid: 88147 topic_id: 30607 reply_id: 122654[/import]

Actually, there’s a warning about joint changes here from the 2.2.1 (sdk 873) here :
http://docs.coronalabs.com/api/type/Joint/index.html

But link to joint guide ( http://developer.coronalabs.com/content/game-edition-physics-joints ) does not seem to be updated…

Things are not clear about joints now …

Anyway, since this topic finds no interest among the community I’ll try to test and find how to make my pivot revolution work again … [import]uid: 9328 topic_id: 30607 reply_id: 123532[/import]

Actually, there’s a warning about joint changes here from the 2.2.1 (sdk 873) here :
http://docs.coronalabs.com/api/type/Joint/index.html

But link to joint guide ( http://developer.coronalabs.com/content/game-edition-physics-joints ) does not seem to be updated…

Things are not clear about joints now …

Anyway, since this topic finds no interest among the community I’ll try to test and find how to make my pivot revolution work again … [import]uid: 9328 topic_id: 30607 reply_id: 123532[/import]

I’m sorry to come back but I can’t find any decent solution to make my “pivot revolution” work under the >870 sdk.

Anyone managed to make it work ?

BTW, the search option on corona website is weird : typing a search leads to answers under “recent posts” links, those leading to recentpost page where there are no sign of the research … :((( [import]uid: 9328 topic_id: 30607 reply_id: 125024[/import]

Have either of you filed this as a bug? If I could get the # that would be helpful to check on status :slight_smile: [import]uid: 52491 topic_id: 30607 reply_id: 125234[/import]

I’m sorry to come back but I can’t find any decent solution to make my “pivot revolution” work under the >870 sdk.

Anyone managed to make it work ?

BTW, the search option on corona website is weird : typing a search leads to answers under “recent posts” links, those leading to recentpost page where there are no sign of the research … :((( [import]uid: 9328 topic_id: 30607 reply_id: 125024[/import]

Thx for your concern Peach.

I have not post it as a bug, since I thought it was just a new box2d behavior. [import]uid: 9328 topic_id: 30607 reply_id: 125409[/import]

Have either of you filed this as a bug? If I could get the # that would be helpful to check on status :slight_smile: [import]uid: 52491 topic_id: 30607 reply_id: 125234[/import]

Thx for your concern Peach.

I have not post it as a bug, since I thought it was just a new box2d behavior. [import]uid: 9328 topic_id: 30607 reply_id: 125409[/import]