This is probably the only issue I’m having before releasing the SVG Level Builder.
If I have a physics body rotated and its reference point is not the center, collisions won’t work as expected. They will either process as the body was in front or behind of the actual body.
Another one: the ground rectangle is TopLeft Reference Point too, but since it is not rotated the circles are correctly colliding.
On the following test code, the circles collide before hitting the first rectangle and then collide in the middle of the second rectangle.
Noticed the thing on the screenshots: Debug boxes are drawn correctly, and the collisions are processed as the box were positioned as centered [import]uid: 10990 topic_id: 8019 reply_id: 28551[/import]
I just made another test and noticed that rectangles and custom shaped bodies go crazy with TopLeft reference point, not only when rotated, but always. [import]uid: 10990 topic_id: 8019 reply_id: 28804[/import]
Bump! Any update on the situation @Carlos? I need a fix for this problem, but it still seems to exist as of the newest stable release! Thank you for you continued support Ansca! [import]uid: 67379 topic_id: 8019 reply_id: 42807[/import]
What you are seeing is the limitation of Box2D used to implement Physics in Corona.
When you turn a vector into a physics object, the Physics engine owns the object and has it own rules about the object. Physics assumes the reference point of the object is the center of the object so setReferencePoint() may change the reference point from Corona’s Display Object point of view but not from the Physics engine.
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.
You can see how the Physics engine view the object with Debug view.
This issue is well known to Box2D users and we need to update our Physic API docs to make this clearer. [import]uid: 7559 topic_id: 8019 reply_id: 42901[/import]
Thank you for the response, so is there any workaround for this issue? I really need to rotate a kinematic sensor around a leftcenter reference point, but I also need it to register collisions normally. [import]uid: 67379 topic_id: 8019 reply_id: 43335[/import]