Sign in to follow this  

Mapping collision object with entities

This topic is 2335 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi im trying to develop a generic 2d collision system. The system should inform if a collision took place and separate the collision objects(rectangle or circle).
On the other hand i have my game objects,that have a collision objects (composition). Now the problem comes when a collision take palace and i have to know with which game object im colliding, i know the collision object but not the owner(game object).

I could do something dirty and add information about the owner to the collision object but that makes the collision system dependent of the game implementation. I dont know how physics engine solve this problem but i think when you use one you have the same problem of not knowing who owns the collision object.

Any help would be great

Share this post


Link to post
Share on other sites
Just add a void* UserData variable to the collision objects, and you can assign whatever you need to that variable to determine what is associated with that object.

It's what chipmunk physics does for it's collisions.

Share this post


Link to post
Share on other sites

This topic is 2335 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this