   Where to test for collision.
  I have player, enemy and game classes. Both the player and enemy classes are mostly the same, the both contain animations and bounding spheres. The player class' animations are triggered using the keyboard. The next step for me is to trigger the animation on the enemy when it is struck by the player's punch. My idea is to check to see if the punch animation is playing, and if the player's hand intersects with the enemy's head.The trouble I'm having is where do I perform this check? Whatever class I do it in needs to tell the enemy to play the 'getting hit' animation, and the same for the player class when I implement it there. Is my best bet to have an entirely separate class for collision? Then how do I pass the collision events back to the class that needs to know, and how would the receiving class handle it?This problem's been a bit of a head-scratcher, and I could use some help.   
  You're got a complicated scenario on your hands. Checking for collsions between animated meshes is tricky in any case, and you're looking for a specific collision.One approach might be to implement a collision detection function in the enemy class (and in the player class if you're looking for potential collisions there, also). Because sphere collisions are easiest, the function could be something likebool Enemy::SphereCollide(vector3 spherePosition, float sphereRadius){   // check for collision with whatever position or bone, etc., you want   return collision_found;}The Enemy class need not know anything about other classes.Since you're looking for very specific collisions and specific responses, a separate Collision class is a possibility. That class would have to have access to the player's bone positions, either directly or through a function call such as a player class functionvector3 GetBonePosition(int boneNumber);It might get pretty convoluted to try to generalize with a virtual base class for all the actors but it depends on your future needs.   ;  Try using Nvidia PhysX, I'm using it, and I do not care more about the physical and the collisions of my game (I inform some things, and it does the rest)   ;  To clarify, I'm developing for XNA.   ;  Have a look at the Bullet Physics SDK   ;Quote:Original post by GregMichaelHave a look at the Bullet Physics SDKHave you used it? Do you know how it compares to the other SDk's like JigLibx?   ;  Yes I've used Bullet..it's good.No idea about JigLibx, but I know of the original author of JigLib, Danny Chapman and that's good too.   ;  Do you use an event system at all? Where ever you decide to put it, when a collision is detected it should send an event "collision occured". Which can be picked up by whoever needs it (player/enemy) who will then deal with it as they need (play hit animation).I am using physX/Ogre3D and how I would do it is probably like this. I would have a shpere as a fist and a shpere as the head. I just play animations as normal (which move the fist/head etc). I don't have to sworry about checking for collisions but if one occurs then a callback function will be called by physx with information about the collision. From that information I could determine that players fist hit enemys head. I'd then dispatch a message to the enemy/whoever else is listening saying "EnemyXYZ got hit in the head by Player". The enemy would pick it up and do "Play animation hit in head". Maybe you have somehting where damage numbers float off, in which case that system could also listen for the message and react accordingly.   ;Quote:Original post by dirtysteveQuote:Original post by GregMichaelHave a look at the Bullet Physics SDKHave you used it? Do you know how it compares to the other SDk's like JigLibx?Yes guy :)In my opinion the physx is the best   