Categorizing collisions
Posted: Thu Jan 10, 2008 7:03 pm
Hello, I already used chipmunk to replace my homemade physics engine.
I was wondering, how would you implement the following:
You have a sprite A and a "floor" B. Sprite A starts at a certain height over the floor B, so they aren't in contact.
A falls on the floor. Now I want the AI of A to start walking, seeking doors, and so on, since it is contacting A.
The physics part and the AI are already programmed and working. The problem I'm having is how to tell the AI "you are on the ground".
I'm trying to implement a callback function for collisions between objects of the same type of A and floor objects. The problem with this approach is that I'm afraid the function will be called once per simulation step, since the objects will be in contact most of the time (is that so?), and of course I don't need that, I only need to warn the AI that it is on a ground.
Any ideas are welcomed, if you want to take a peek at the project and source you can go here: http://code.google.com/p/cavemen/
Thank you
I was wondering, how would you implement the following:
You have a sprite A and a "floor" B. Sprite A starts at a certain height over the floor B, so they aren't in contact.
A falls on the floor. Now I want the AI of A to start walking, seeking doors, and so on, since it is contacting A.
The physics part and the AI are already programmed and working. The problem I'm having is how to tell the AI "you are on the ground".
I'm trying to implement a callback function for collisions between objects of the same type of A and floor objects. The problem with this approach is that I'm afraid the function will be called once per simulation step, since the objects will be in contact most of the time (is that so?), and of course I don't need that, I only need to warn the AI that it is on a ground.
Any ideas are welcomed, if you want to take a peek at the project and source you can go here: http://code.google.com/p/cavemen/
Thank you