Ahoy! I’m having an issue detecting a collision driven by an enemy player. Below is the basic set-up:
- Player is a static collider tagged “PlayerCollider”
- Enemy is a rigged / animated (Cinema4D) import with a sword as a child of the last joint (hand)
Issue: When enemy animation swings sword, the collider (+ the script below) does not detect a collision (rigidbody projectiles seem to detect just fine)
var glassCrackParticle : GameObject;
function OnCollisionEnter( collision : Collision ) {
if(collision.gameObject.tag == "PlayerCollider"){
print("sword hit");
var contact : ContactPoint = collision.contacts[0];
var rotation = Quaternion.FromToRotation( Vector3.up, contact.normal);
var instantiatedExplosion : GameObject = Instantiate(glassCrackParticle, contact.point, rotation);
}
}
Is there something to animated rigs with weapons attached to them don’t detect quite right?
Thanks in advance
CapnJ
Hmm, that sounds absolutely correct, but making those adjustments in my situation didn't work. But your answer IS correct so I'm going to mark it. Something else that did end up working was to leave the sword as non-kinematic and no-gravity, while turning all of the position and rotation constraints.
– anon4796025