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.