Topic: Get Collisions in C++?

I'm just trying to get some trigger stuff firing off, is there a way to get back a list of the currently collided objects?

I don't think there is, all I can see is isObjectInCollision, I think I need to loop through every object in the seen and then test collision... is this right? :S

Re: Get Collisions in C++?

No... there is no other way right now, I'll see if I can add it.

Re: Get Collisions in C++?

Thanks. I will leave this for now and work on something else smile

Re: Get Collisions in C++?

Hi,

I added optional arguments to "isObjectInCollision" :

static unsigned int collisionList[MAX_COLLISION]; // objectId list of other physics-objects in collision
int nbCollision = physics->isObjectInCollision(objectId, collisionList, MAX_COLLISION);

I also added a function to set/get physics-object user pointer, which is the entity pointer in MEngine by default,
so you can get the entity pointer of the physics-objects by using :

for(i=0; i<MIN(nbCollision, MAX_COLLISION); i++)
{
    MOEntity * entity = (MOEntity *)physics->getObjectUserPointer(collisionList[i]);
}

Re: Get Collisions in C++?

That's awesome! Thanks smile