I have a pocketknife inside my project which I imported through a .blend (Blender) file.
I want to have it as a collectable item by the user and thus, I want it to rotate and disappear once the MainChar has collided with it.
So, I’ve added to the pocketknife a rigidbody (without the use of gravity because I want it to be on the air). Then, I’ve added to it a Mesh Collider whith ‘Is Trigger’ checked. Then I’ve attached this script to the pocketknife:
function OnTriggerEnter(hit:Collider){
Debug.Log("Something hit me!");
if(hit.gameObject.name=="MainChar"){
Destroy(gameObject);
hasKnife=true;
}
}
I don’t even get the Something hit me!
message…