- Home /
Collision Dection on Tigger Enter
After a few days of struggling with this I'm still having problems. So I thought I'd try here again.
I have a sword attached to my character, the sword has a mesh collider along with isTrigger set to true.
How would I go about detecting a collision based off of this?
this is what I have thus far:
//on the weapon var Damage=5; function onCollisionEnter(collision : Collider) { collision.BroadcastMessage("TakeDamage",Damage); }
//on the object to be hit
var Hp : int=100; //take damage function not shown--
function onTriggerEnter(other : Collider)
{
TakeDamage(10);
}
everything else works, i'm just simply having trouble getting things to work on collision. the collision doesn't register, or I coded it wrong. Any help would be appreciated.
Answer by DaveA · Aug 19, 2011 at 10:17 PM
OnCollisionEnter has a capital O. So does On-anythingelse
Thanks for the heads up. After fixing that I had a few errors but I got it working.
If you got it working why dont you mark this answer correct?
Your answer
Follow this Question
Related Questions
Flying Controls Collision Issues 0 Answers
More accurate collision detection 1 Answer
Collision Error: Object won't delete. 0 Answers
Why there is no Collider.IsTouching(...) ? 2 Answers
How do you raycast from an object ignoring only that object? 0 Answers