Physics Outline + Collision Filter Issues

You guys aren’t encouraging me to help here… 

  1. You shouldn’t complain about paying a small amount to use a tool that saves you a lot of work.

  2. I’m not pleased to see comments to the effect, “I found a way not to pay…”

All I was saying was that I realized that Corona has a built in function to do the same thing so want want to learn how to use that. The shape that it is drawing seems to be correct enough for me, it is just not detecting collisions anymore.

I’d try these debug steps:

Test 1 - Make the body with no filters, and test it.

  • WORKS -  The filter is wrong.  Evaluate your filter settings and try again.
  • FAILS - Move on the test 2

Test 2 - Make the body with your filter and a default shape (no outline).

  • WORKS -  The outline is goofed up.
  • FAILS - Move on the test 3.

Test 3 - Make a small (very simple) test bench:

  • main.lua - Write a small sample using your filter settings, outline, and collision listener.  Demonstrate it fails.
  • config.lua - Basic iPhone 4 size setup and letterbox scaling
  • build.settings - Landscape or portrait orientation only (whatever suits your example).
  • include outline asset and other images used in example.

Run the sample.  If it fails, use this to file a bug, but share a link to a ZIP containing all the above here too so others can help debug.

-Ed

There is another alternative here.  Don’t hand calculate filters.  Use my collision calculator instead.  Its free and much easier than calculating filters.

https://store.coronalabs.com/plugin/collision-calculator

If you don’t want to use it as a plugin, you can find the same code in SSK:

Ya sorry @roaminggamer. That was some time ago I did that on my laptop. I built my own pc now and I bought the product like a week ago. When I need something i do buy it now as I do understand that as a developer I get why devs want a small fee for their hard work. --SonicX278

@mpkostech What I do is make a new project and put code in little by little till you find what’s wrong. --SonicX278

My problem is that Corona completely crashes and closes when I use the actual ship group (which is what I do throughout my code and I get expected results). When I replace the ship group with just the ship’s image (as in the code below, Corona does not crash but there is no collision:

function Ship:new(X, Y) local ship = display.newGroup() ship.x = X ship.y = Y ship.objectType = "ship" ship.health = shipHealth ship.shipLaserGroup = display.newGroup() moveGroup:insert(ship.shipLaserGroup) ship.shipImage = display.newImage(sheet,sheetInfo:getFrameIndex(shipName)) ship.shipImage.xScale = 0.7 ship.shipImage.yScale = 0.7 ship:insert(ship.shipImage) local group = display.newGroup() local particle = pex.load("Exhaust/exhaust.pex","Exhaust/texture.png") local emitter = display.newEmitter(particle) emitter.x = ship.shipImage.x emitter.y = ship.shipImage.y + ship.shipImage.height/2 ship:insert(emitter) local shipOutline = graphics.newOutline( 2, sheet, sheetInfo:getFrameIndex(shipName)) local shipCollisionFilter = { categoryBits = bitTable.ship, maskBits = bitTable.enemyLaser } physics.addBody( ship.shipImage, "static", {filter = shipCollisionFilter, outline = shipOutline}) return ship end

Should I be reporting this as a bug? Corona consistently crashes when I try to use a group as a physics body in conjunction with an outline.

@mpkostek,

  1. Forums etiquette note - You should only use the quote option to respond to a small part of someone’s post like this:

If you don’t need to quote a specific part of the persons response and you want to address that person in your addition to the forum thread do this:

@persons name,

Say what you want here…

Re-quoting every response just wastes space and is hard tor read with no addition of meaning or context.

  1. To answer your question.  Yes, file a bug, but make a very small test bench demonstrating the issue and submit that as a bug.  Don’t expect the Corona staff to write the example themselves.

-Ed