I’ve a scene whith a character and some mobs. My character can throw magic missiles.
Both missiles and mobs have a capsule colider. My probleme is:
The colision dectection dint alway happen betwen missiles and mobs.
my mobs have annimation and i’ve noticed this:
-When mob are charging at my character(running animation), collision always happen.
-when mob are ataking me(attack animation), collision never happen.
-when mob are standding(idle annimation), collision never happen.
-when mob are dead (one diying animation then no animation), collision always happen.
When I start my game and i set visible gismo view, I can notice that the capsule colider gismo are ALWAYS active and at the good location so, i dont understand the correlation betwen my mobs state/annimation state and the detection/non-detection of colision.
The problem probably has nothing to do with animations: collision detection is done by the physics engine based on the colliders, rigidbodies and character controllers, and the bones are usually game objects without colliders, thus should not interfere with the collision system.
If the mob is a CharacterController and the missiles are rigidbodies, you must take into account the following:
1- OnCollision events are produced when a rigidbody hits the character, but always never when the character hits the rigidbody. This event is sent to both, the character and the rigidbody.
2- To detect collisions character->rigidbody, use OnControllerColliderHit. This event is sent only to the character script, and doesn’t detect collisions rigidbody->character (use OnCollisionEnter for rigidbody->character collisions).
If this doesn’t help, please edit your question and post the relevant parts of your scripts, as well as some basic info about the mob and the missiles (if they are character controllers or rigidbodies, for instance).