Request for help on collision callbacks

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
invisisci
Prole
Posts: 12
Joined: Sun Feb 01, 2009 5:35 am

Request for help on collision callbacks

Post by invisisci »

Hi all,

OK, so I've done this:

Code: Select all

function load()
	world = love.physics.newWorld(2000, 2000)
	world:setCallback(collision)
...and then I've used:

Code: Select all

body1.circleShape:setData("foo")
body2.circleShape:setData("bar")
...on my collision shapes.

Finally, I've implemented the collision handler:

Code: Select all

function collision(a, b, c) 
	collisionDebugMsg = "Collided: " .. a .. " + " .. b
When body1 and body 2 collide, collision(a,b,c) is called correctly. "a" and "b" contain the shape data, as expected:

Collided: foo + bar

My question is: What is "c"? I get an error if I try to cat it in my collisionDebugMsg. I can't find any info in the physics documentation. I tried scanning the Box2D manual, but that didn't help me either. I'm sure I'm missing something obvious... anyway my overall goal is to get a hold of the specific shape instance that is colliding, so I can do things to it (I have many "body1" objects instantiated). I'm assuming c is some kind of contact object that I can use to find the actual objects that are colliding?

I'm investigating further, but I thought I'd post my query while I keep looking.
invisisci
Prole
Posts: 12
Joined: Sun Feb 01, 2009 5:35 am

Re: Request for help on collision callbacks

Post by invisisci »

OK never mind, I figured it out.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 11 guests