currently i have a Player (moves and stuff) (tagged Player)within the Player i have a sword which (tagged sword). i want to check if a cube hits the sword. how would i go about this?
i have tried using triggers and normal collision (have used rigidbody, box, spehere,mesh...collders)
this script is attached to a cube
function OnCollisionEnter(hit : Collision) {
if (hit.gameObject.tag=="sword"){
print ("hit");
}}
You didn't say what exactly is happening, but odds are you are having the common problem of not getting notified of any collisions. If you search Answers for OnCollision and OnTrigger you can see how other people have fixed it. Make sure both objects have colliders; one of them needs a Rigidbody on it as well.
It's possible that OnCollisionEnter IS getting called, in which case the problem may be with your If statement. Make sure you spelled and capitalized the tag name correctly in your code. Aldwoni's suggestion can help you see if that's happening: add his Debug.Log command to the first line of your OnCollisionEnter method, or use breakpoints (if you are debugging with MonoDevelop.)