Problem with graphics 2.0 and physics

I had migrated my game right well, but I noticed something extrange, my game is a top down car game with physics, so if I run game in hybrid mode I can see the lines of joints from wheels to the body moving with the car perfectly, but when I migrated to graphics 2.0 joints lines does not move correctly, only in the top left corner body shapes and joint lines seems to match, but when moving car joint lines move out of car.

This is an image showing how when I move the car the joint lines do not moves acorde to the body. 

coronabug.jpg

I use OOP so I have an object and a wheel classes, next I past the code in car class in which wheels and joints are created:
 

-- Create body local params\_physics = physicsData:get(params.model) params\_physics.bounce = components.chasis.bounce or 0.1 --Force feecback params\_physics.density = self.mass / 1000 --To calculate mass of object params\_physics.friction = components.chasis.friction or 0.5 --friction when rubbing agaisnt other shapes params\_physics.isbullet = true --dedicates more time to collision detection - car travelling at high speeds at low framerates otherwise might teleport through obstacles. params\_physics.linearDamping = components.aerodinamics.linearDamping or 0.5 -- simulates friction of AIR params\_physics.angularDamping = components.aerodinamics.angularDamping or 0.5 -- stops CAR from spinning forever local params\_carrace = {} params\_carrace.entityParent = self params\_carrace.name = 'body' params\_carrace.type = "IMAGE" params\_carrace.x = params.x params\_carrace.y = params.y params\_carrace.width = components.chasis.width params\_carrace.height = components.chasis.height params\_carrace.blendMode = params.blendMode or "normal" params\_carrace.rotation = 0 params\_carrace.initialRotation = self.initialRotation params\_carrace.alpha = params.alpha or 1 params\_carrace.gradient = nil params\_carrace.pathImage = resources.cars[self.model] params\_carrace.displayGroupParent = self.layer params\_carrace.hasBody = true params\_carrace.isDraggable = params.isDraggable params\_carrace.dragDamping = 0.7 params\_carrace.dragMaxForce = 1000 params\_carrace.dragFrequency = 50 params\_carrace.params\_physics = params\_physics local body = Object:new(params\_carrace) self.body = body self:addObject (body) body.object:setFillColor(self.color[1],self.color[2],self.color[3]) ---------------------------------------------------------------------------------- ---- WHEELS --------------------------------------------------------------------------------- -- Wheels object params local params\_wheel = { model = self.components.wheels, car = self, } -- Left Frontal wheel params\_wheel.name ='leftFrontalWheel' params\_wheel.x = body.object.x - body.object.width \* 0.5 + components.wheels.width \* 0.5 params\_wheel.y = body.object.y - (body.object.height \* 0.4) + components.wheels.height \* 0.5 params\_wheel.powered = (self.traction == 'F' or self.traction == '4') params\_wheel.revolute = true local wheel = Wheel:new(params\_wheel) self:addObject (wheel) self.wheels[#self.wheels+1] = wheel local leftFrontalWheel = wheel -- Right Frontal wheel params\_wheel.name ='rightFrontalWheel' params\_wheel.x = body.object.x + body.object.width \* 0.5 - components.wheels.width \* 0.5 params\_wheel.y = body.object.y - (body.object.height \* 0.4) + components.wheels.height \* 0.5 params\_wheel.revolute = true local wheel = Wheel:new(params\_wheel) self:addObject (wheel) self.wheels[#self.wheels+1] = wheel local rightFrontalWheel = wheel -- Left Rear wheel params\_wheel.name ='leftRearWheel' params\_wheel.x = body.object.x - body.object.width \* 0.5 + components.wheels.width \* 0.5 params\_wheel.y = body.object.y + (body.object.height \* 0.4 ) - components.wheels.height \* 0.5 params\_wheel.powered = (self.traction == 'T' or self.traction == '4') params\_wheel.revolute = false local wheel = Wheel:new(params\_wheel) self:addObject (wheel) self.wheels[#self.wheels+1] = wheel local leftRearWheel = wheel -- Right Rear wheel params\_wheel.name ='rightRearWheel' params\_wheel.x = body.object.x + body.object.width \* 0.5 - components.wheels.width \* 0.5 params\_wheel.y = body.object.y + (body.object.height \* 0.4) - components.wheels.height \* 0.5 params\_wheel.revolute = false local wheel = Wheel:new(params\_wheel) self:addObject (wheel) self.wheels[#self.wheels+1] = wheel local rightRearWheel = wheel -- Set powered wheels for i=1, #self.wheels do wheel = self.wheels[i] if wheel.powered then self.poweredWheels[#self.poweredWheels+1] = wheel end if wheel.revolute then self.revoluteWheels[#self.revoluteWheels+1] = wheel end end local maxSteerAngle = self.setup.maxSteerAngle ------------------------------------------------ -- Frontal powerded and revoluted ------------------------------------------------ local params\_join = { name = 'jointLeftFrontalWheel', type = "pivot", obj2= leftFrontalWheel.name, obj1= body.name, anchorX1 = leftFrontalWheel.object.x, anchorY1 = leftFrontalWheel.object.y, } local myJoint = self:createJoint (params\_join) myJoint.isLimitEnabled = true -- (boolean) myJoint:setRotationLimits( maxSteerAngle \* -1, maxSteerAngle ) local params\_join = { name = 'jointRightFrontalWheel', type = "pivot", obj2= rightFrontalWheel.name, obj1= body.name, anchorX1 = rightFrontalWheel.object.x, anchorY1 = rightFrontalWheel.object.y, } local myJoint = self:createJoint (params\_join) myJoint.isLimitEnabled = true -- (boolean) myJoint:setRotationLimits( maxSteerAngle \* -1, maxSteerAngle ) ------------------------------------------------ -- Rear fixed wheels ------------------------------------------------ local params\_join = { name = 'jointLeftRearWheel', type = "weld", obj2= leftRearWheel.name, obj1= body.name, anchorX1 = leftRearWheel.object.x, anchorY1 = leftRearWheel.object.y, } self:createJoint (params\_join) local params\_join = { name = 'jointRightRearWheel', type = "weld", obj2= rightRearWheel.name, obj1= body.name, anchorX1 = rightRearWheel.object.x, anchorY1 = rightRearWheel.object.y, } self:createJoint (params\_join) -- Sends body to front of dysplay body.object:toFront()  

I’ve noticed the same thing. Is Hybrid Mode physics in Graphics 2.0 a little wonky? I migrated a game which showed fine in hybrid mode with the previous graphics 1.0, but with graphics 2.0 all of the hybrid lines/joints etc seem to have a mind of there own. They don’t match up when things start moving. The funny thing is the game seems to be functioning correctly but it just looks all messed up in hybrid mode which is a little concerning.

Maybe there is something we are missing to make the hybrid mode display correctly in the new graphics 2.0?

Hi @kRona,

Can you file a simple test case as a bug report so we can investigate? Preferably something showing a few simple joints and how they are not appearing as expected.

Sincerely,

Brent Sorrentino

Sure no prob!

In my case is a problem because I should post entire project, because I see the problem when I move the car around the display. It is not posible to reproduce by only creating the objects and joints in dysplay, you must move body by aplying force to wheels.

I posted the code in witch I create phisical car body and wheels and the joints between them, two pivot joins for frontal wheels and 2 weld joints from fixed rear wheels.

Seems to be a desincronization between display joints and body when displaying in hybrid mode, because game seems to rune fine.

I will try to implement collide detections in order to check if there are any troubles with them.

Hi, I have the same problem,

In the Corona SDK 1202 the app works fine.

In the last version of Corona SDK 2076, in the Android Tablet displays a black screen or weird images (in the emulator the app works fine).

Pictures of build in 1202:

Pictures of build in 2076:

I am testing in a Samsung Galaxy Tab

I hope you can help me,

@Brent

ok report submitted. It’s not that big a deal, collisions still work as expected, it’s just the hybrid display is out of line. I tested with the current public release with Graphics 2.0 and the latest 2013.2086. I should have mentioned I am on a Mac and I am seeing this in the simulator. If you can amend the report somehow, it is Case 28252

Thanks!

Hi @kRona,

Thanks for the report. We’re checking into it.

@gustavargas,

Your issue may be hardware-related. Which Galaxy Tab model are you testing on? Can you give me a more specific model name/number and year of production?

Thanks,
Brent Sorrentino

I have the same issue with the graphics on my Razr Maxx.  I started a thread about it in the android section (link below).  Is there an eta on when this issue will be fixed?

http://forums.coronalabs.com/topic/41369-black-screen-with-20132076-public-build-on-razr-maxx/

Hi @Brent,

Model: GT-P5110

Serial No: R22D80150JT

Year production: I don’t know

Android: 4.1.2

Kernel: 3.0.31-812001 se.infra@SEI-75 #1 SMP PREEMPT Fri Jan 25 22:04:12 KST 2013

Compilation Number: JZO54K.P5110XXDMA2

I recently did a factory reset in the tablet and reinstalled the app, the same problem too.

Thanks you!

I’m having the same problem as @gustavargas with a galaxy tab too and I’m using Corona Enterprise 2013.2078.

The weird part is that it works fine on a Xperia Sola with android 4.0.4 and on a Nexus 7 first gen with 4.1

I made some searches on google and it seems that galaxy tab have some problems with shaders:

http://stackoverflow.com/questions/11398114/vertex-shader-doesnt-run-on-galaxy-tab10-tegra-2

http://stackoverflow.com/questions/18540792/opengl-es-2-vertex-shader-issue-on-samsung-galaxy-tab-2

I don’t know if this is the case, but maybe the 2 links above could help solving this problem on galaxy tab and other devices.

I use OOP so I have an object and a wheel classes, next I past the code in car class in which wheels and joints are created:
 

-- Create body local params\_physics = physicsData:get(params.model) params\_physics.bounce = components.chasis.bounce or 0.1 --Force feecback params\_physics.density = self.mass / 1000 --To calculate mass of object params\_physics.friction = components.chasis.friction or 0.5 --friction when rubbing agaisnt other shapes params\_physics.isbullet = true --dedicates more time to collision detection - car travelling at high speeds at low framerates otherwise might teleport through obstacles. params\_physics.linearDamping = components.aerodinamics.linearDamping or 0.5 -- simulates friction of AIR params\_physics.angularDamping = components.aerodinamics.angularDamping or 0.5 -- stops CAR from spinning forever local params\_carrace = {} params\_carrace.entityParent = self params\_carrace.name = 'body' params\_carrace.type = "IMAGE" params\_carrace.x = params.x params\_carrace.y = params.y params\_carrace.width = components.chasis.width params\_carrace.height = components.chasis.height params\_carrace.blendMode = params.blendMode or "normal" params\_carrace.rotation = 0 params\_carrace.initialRotation = self.initialRotation params\_carrace.alpha = params.alpha or 1 params\_carrace.gradient = nil params\_carrace.pathImage = resources.cars[self.model] params\_carrace.displayGroupParent = self.layer params\_carrace.hasBody = true params\_carrace.isDraggable = params.isDraggable params\_carrace.dragDamping = 0.7 params\_carrace.dragMaxForce = 1000 params\_carrace.dragFrequency = 50 params\_carrace.params\_physics = params\_physics local body = Object:new(params\_carrace) self.body = body self:addObject (body) body.object:setFillColor(self.color[1],self.color[2],self.color[3]) ---------------------------------------------------------------------------------- ---- WHEELS --------------------------------------------------------------------------------- -- Wheels object params local params\_wheel = { model = self.components.wheels, car = self, } -- Left Frontal wheel params\_wheel.name ='leftFrontalWheel' params\_wheel.x = body.object.x - body.object.width \* 0.5 + components.wheels.width \* 0.5 params\_wheel.y = body.object.y - (body.object.height \* 0.4) + components.wheels.height \* 0.5 params\_wheel.powered = (self.traction == 'F' or self.traction == '4') params\_wheel.revolute = true local wheel = Wheel:new(params\_wheel) self:addObject (wheel) self.wheels[#self.wheels+1] = wheel local leftFrontalWheel = wheel -- Right Frontal wheel params\_wheel.name ='rightFrontalWheel' params\_wheel.x = body.object.x + body.object.width \* 0.5 - components.wheels.width \* 0.5 params\_wheel.y = body.object.y - (body.object.height \* 0.4) + components.wheels.height \* 0.5 params\_wheel.revolute = true local wheel = Wheel:new(params\_wheel) self:addObject (wheel) self.wheels[#self.wheels+1] = wheel local rightFrontalWheel = wheel -- Left Rear wheel params\_wheel.name ='leftRearWheel' params\_wheel.x = body.object.x - body.object.width \* 0.5 + components.wheels.width \* 0.5 params\_wheel.y = body.object.y + (body.object.height \* 0.4 ) - components.wheels.height \* 0.5 params\_wheel.powered = (self.traction == 'T' or self.traction == '4') params\_wheel.revolute = false local wheel = Wheel:new(params\_wheel) self:addObject (wheel) self.wheels[#self.wheels+1] = wheel local leftRearWheel = wheel -- Right Rear wheel params\_wheel.name ='rightRearWheel' params\_wheel.x = body.object.x + body.object.width \* 0.5 - components.wheels.width \* 0.5 params\_wheel.y = body.object.y + (body.object.height \* 0.4) - components.wheels.height \* 0.5 params\_wheel.revolute = false local wheel = Wheel:new(params\_wheel) self:addObject (wheel) self.wheels[#self.wheels+1] = wheel local rightRearWheel = wheel -- Set powered wheels for i=1, #self.wheels do wheel = self.wheels[i] if wheel.powered then self.poweredWheels[#self.poweredWheels+1] = wheel end if wheel.revolute then self.revoluteWheels[#self.revoluteWheels+1] = wheel end end local maxSteerAngle = self.setup.maxSteerAngle ------------------------------------------------ -- Frontal powerded and revoluted ------------------------------------------------ local params\_join = { name = 'jointLeftFrontalWheel', type = "pivot", obj2= leftFrontalWheel.name, obj1= body.name, anchorX1 = leftFrontalWheel.object.x, anchorY1 = leftFrontalWheel.object.y, } local myJoint = self:createJoint (params\_join) myJoint.isLimitEnabled = true -- (boolean) myJoint:setRotationLimits( maxSteerAngle \* -1, maxSteerAngle ) local params\_join = { name = 'jointRightFrontalWheel', type = "pivot", obj2= rightFrontalWheel.name, obj1= body.name, anchorX1 = rightFrontalWheel.object.x, anchorY1 = rightFrontalWheel.object.y, } local myJoint = self:createJoint (params\_join) myJoint.isLimitEnabled = true -- (boolean) myJoint:setRotationLimits( maxSteerAngle \* -1, maxSteerAngle ) ------------------------------------------------ -- Rear fixed wheels ------------------------------------------------ local params\_join = { name = 'jointLeftRearWheel', type = "weld", obj2= leftRearWheel.name, obj1= body.name, anchorX1 = leftRearWheel.object.x, anchorY1 = leftRearWheel.object.y, } self:createJoint (params\_join) local params\_join = { name = 'jointRightRearWheel', type = "weld", obj2= rightRearWheel.name, obj1= body.name, anchorX1 = rightRearWheel.object.x, anchorY1 = rightRearWheel.object.y, } self:createJoint (params\_join) -- Sends body to front of dysplay body.object:toFront()  

I’ve noticed the same thing. Is Hybrid Mode physics in Graphics 2.0 a little wonky? I migrated a game which showed fine in hybrid mode with the previous graphics 1.0, but with graphics 2.0 all of the hybrid lines/joints etc seem to have a mind of there own. They don’t match up when things start moving. The funny thing is the game seems to be functioning correctly but it just looks all messed up in hybrid mode which is a little concerning.

Maybe there is something we are missing to make the hybrid mode display correctly in the new graphics 2.0?

Hi @kRona,

Can you file a simple test case as a bug report so we can investigate? Preferably something showing a few simple joints and how they are not appearing as expected.

Sincerely,

Brent Sorrentino

Sure no prob!

In my case is a problem because I should post entire project, because I see the problem when I move the car around the display. It is not posible to reproduce by only creating the objects and joints in dysplay, you must move body by aplying force to wheels.

I posted the code in witch I create phisical car body and wheels and the joints between them, two pivot joins for frontal wheels and 2 weld joints from fixed rear wheels.

Seems to be a desincronization between display joints and body when displaying in hybrid mode, because game seems to rune fine.

I will try to implement collide detections in order to check if there are any troubles with them.