reference point breaks physics

setting a reference point, breaks the physics even though the hybrid view suggests it is correct… here is a self contained example based on the original post here:
http://developer.anscamobile.com/forum/2011/03/06/physics-issue-reference-points

[lua]local physics = require(“physics”)
local rnd=math.random

physics.start()
physics.setDrawMode(“hybrid”)
physics.setGravity(0,0)

line = display.newRect(0,0,6,250)
line:setFillColor(255,0,0,255)

– **** this line breaks it ****
line:setReferencePoint(display.BottomCenterReferencePoint)

line.x = display.contentWidth/2
line.y = display.contentHeight/2
line.rotation = 0

physics.addBody(line, “kinematic”)
line.isBullet=true

line.angularVelocity=100

function spawnBall()
local radius = rnd(5,30)
local ball = display.newCircle(0,0,radius)
ball:setFillColor(0,255,0,255)
ball.x = rnd(100,350)
ball.y = rnd(300,400)
physics.addBody(ball,“dynamic”, {radius=radius})
ball.isBullet=true
end

timer.performWithDelay(10, spawnBall,100)[/lua] [import]uid: 6645 topic_id: 7518 reply_id: 307518[/import]

I am bumping this as no Asnca staff has responded to it. Looking through the bug reports there seem to be a lot of complaints about the reference points breaking physics. Can we get some kind of an ETA on this issue being looked at/solved?

Thanks! [import]uid: 36054 topic_id: 7518 reply_id: 28047[/import]

I just ran into the following bug concerning reference points:

[lua]local ggg = display.newGroup()
print(ggg.x,ggg.y)
ggg:setReferencePoint(display.CenterReferencePoint)
print(ggg.x,ggg.y)[/lua]

prints out:

0 0
1073741824 -0.99975943565369

It seems that an empty group, with bounds of [0,0,0,0], gives weird results for setReferencePoint instead of (0,0). Maybe devision by zero somewhere…(?).

I was trying to align my objects with setReferencePoint’s and it took me a big part of the day to figure out where my windows were going and why :-(.

-FrankS. [import]uid: 8093 topic_id: 7518 reply_id: 28299[/import]

Major issue BUMP.

[import]uid: 79135 topic_id: 7518 reply_id: 57145[/import]

Hey guys,

What’s the bug # ? [import]uid: 52491 topic_id: 7518 reply_id: 57246[/import]

  1. From the physics.addBody() API page:
    "When you turn a display object into a physics object, the Physics engine owns the object and has its own rules about the object. Physics assumes the reference point of the object is the center of the object so object:setReferencePoint() may change the reference point from Corona’s Display Object point of view but not for the Physics engine. This affects collisions and how other physics bodies interact…

The same goes for scaling and rotating the object. You can scale the object up or down and rotate it but the Physics engine still sees the object as it was before the changes."

  1. There is a know bug documented on the display.newGroup API page about group properties returning wrong results when the group is empty. The solution is insert something in the group first (even an invisible small object) if you need the properties of an empty group.

I’ve been trying to update the API pages for known issues like these so it’s best to check the docs first. You can also add comments to the API docs pages and I’ll add the information if it’s appropriate.

-Tom [import]uid: 7559 topic_id: 7518 reply_id: 57279[/import]