Collision with multi-element bodies

Following the instructions on this page (http://developer.anscamobile.com/content/game-edition-collision-detection), I set up a runtime event listener to catch collisions between two objects - and ice cube and a glass.

The glass is made up of five physics elements via Physics Editor, but the values in onCollision of event.element1 (or element2 if that is the case) are not 1 thru 5. There are more than five values and they’re all over the map: 8, -8, 10, -33, etc.

Has anyone seen anything like this before? [import]uid: 58455 topic_id: 12179 reply_id: 312179[/import]

OK, it looks like the numbers event.selfElement and event.otherElement contain are the vertices of the physics shapes. Is this a Corona bug, or does it just not support Physics Editor generated shapes for event.selfElement and event.otherElement?
[import]uid: 58455 topic_id: 12179 reply_id: 44405[/import]

BTW, the code below is what I sent in my bug report if anyone wants to take a look. Maybe I’m missing something basic.

The image is at http://mikesellsoftware.com/BeerMug.png, two source files below.

main.lua:

  
local physics = require("physics")  
physics.start()  
  
local group = display.newGroup()  
local physicsData = (require "shapedefs").physicsData(1.0)  
  
-- Create mug1  
local mug1 = display.newImage("BeerMug.png")  
mug1.x = display.contentWidth/2  
mug1.y = 0  
mug1.type = "mug1"  
group:insert(mug1)  
physics.addBody(mug1, "dynamic", physicsData:get("BeerMug"))  
  
-- Create mug2  
local mug2 = display.newImage("BeerMug.png")  
mug2.x = display.contentWidth/2  
mug2.y = display.contentHeight - mug2.contentHeight  
mug2.type = "mug2"  
group:insert(mug2)  
physics.addBody(mug2, "static", physicsData:get("BeerMug"))  
  
local function onCollision(event)  
 if (event.phase == "ended") then  
 print(event.object1.type .. ": " .. event.element1)  
 print(event.object2.type .. ": " .. event.element2)  
 end  
end  
  
Runtime:addEventListener("collision", onCollision)  

shapedefs.lua:

-- This file is for use with Corona(R) SDK  
--  
-- This file is automatically generated with PhysicsEdtior (http://physicseditor.de). Do not edit  
--  
-- Usage example:  
-- local scaleFactor = 1.0  
-- local physicsData = (require "shapedefs").physicsData(scaleFactor)  
-- local shape = display.newImage("objectname.png")  
-- physics.addBody( shape, physicsData:get("objectname") )  
--  
  
-- copy needed functions to local scope  
local unpack = unpack  
local pairs = pairs  
local ipairs = ipairs  
  
module(...)  
  
function physicsData(scale)  
 local physics = { data =  
 {   
  
 ["IceCube"] = {  
  
 {  
 density = 0.5, friction = 0.2, bounce = 0.5,   
 filter = { categoryBits = 2, maskBits = 3 },  
 shape = { -10.5, 8 , -10.5, -10 , -5, 8.5 , -6, 9.5 , -9, 9.5 }  
 } ,  
 {  
 density = 0.5, friction = 0.2, bounce = 0.5,   
 filter = { categoryBits = 2, maskBits = 3 },  
 shape = { 9, -10.5 , 9.5, -10 , -2, 8.5 , -5, 8.5 , -10.5, -10 , -10, -10.5 }  
 } ,  
 {  
 density = 0.5, friction = 0.2, bounce = 0.5,   
 filter = { categoryBits = 2, maskBits = 3 },  
 shape = { -1, 9.5 , -2, 8.5 , 9.5, -10 , 9.5, 8 , 8, 9.5 }  
 }   
 }  
  
 ,   
 ["BeerMug"] = {  
  
 {  
 density = 2, friction = 0, bounce = 0,   
 filter = { categoryBits = 1, maskBits = 2 },  
 shape = { -38, 49 , -40, 2 , -33, -49 }  
 } ,  
 {  
 density = 2, friction = 0, bounce = 0,   
 filter = { categoryBits = 1, maskBits = 65535 },  
 shape = { -32, 27 , -35, 47 , -34, 9 }  
 } ,  
 {  
 density = 2, friction = 0, bounce = 0,   
 filter = { categoryBits = 1, maskBits = 65535 },  
 shape = { 15, 46 , 13, 32 , 15, 11 }  
 } ,  
 {  
 density = 2, friction = 0, bounce = 0,   
 filter = { categoryBits = 1, maskBits = 65535 },  
 shape = { -37, 52 , -13, 46 , 15, 52 }  
 } ,  
 {  
 density = 2, friction = 0, bounce = 0,   
 filter = { categoryBits = 1, maskBits = 65535 },  
 shape = { 17, 4 , 19, 48 , 10, -48 }  
 } ,  
 {  
 density = 2, friction = 0.4, bounce = 0.5,   
 filter = { categoryBits = 1, maskBits = 65535 },  
 shape = { 49, 31 , 13, -39 , 38, -38 }  
 } ,  
 {  
 density = 2, friction = 0, bounce = 0,   
 filter = { categoryBits = 1, maskBits = 65535 },  
 shape = { 21, 36 , 31, 29 , 49, 32 }  
 }   
 }  
  
 } }  
  
 -- apply scale factor  
 local s = scale or 1.0  
 for bi,body in pairs(physics.data) do  
 for fi,fixture in ipairs(body) do  
 for ci,coordinate in ipairs(fixture.shape) do  
 fixture.shape[ci] = s \* coordinate  
 end  
 end  
 end  
  
 function physics:get(name)  
 return unpack(self.data[name])  
 end  
  
 return physics;  
end  

[import]uid: 58455 topic_id: 12179 reply_id: 44476[/import]

Did you hear anything yet on this? I have the same problem. [import]uid: 19297 topic_id: 12179 reply_id: 44782[/import]

Heard nothing yet, other than the auto-reply email from the bug report submission.

This will be very annoying to work around. I have two different sounds I want to play depending on which part of an object is involved in a collision. I may be stuck with creating invisible “shadow” physics objects for all of my game objects, which would be highly undesirable. [import]uid: 58455 topic_id: 12179 reply_id: 44787[/import]