OnCollision troubles

Topics: Developer Forum, User Forum
Mar 28, 2011 at 7:27 AM

So I just went through the process of simplifying my games code, I used to have an array for each of my objects class as well as an array containing their farseer bodies. (i.e. object[] and objectBodies[])

But now I just have an array containing my objects class, and the bodies are within these classes. My issue is that I used to be able to find which object was being called during oncollision with "object[fixture1.IndexOf(objectBodies)];" So i would be able to access all the game properties that went along with the collision. But now that everything is contained within one array I have no way of doing this.

Essentially when the OnCollision is called, I need a way of identifying where in the object array the physics body exists. Whats the best way of doing this?