Collider Problems on melee weapon

I am messing around with VR and currently have a pickaxe with sphere colliders at the end as well as a cube with a box collider and a script;

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Rock : MonoBehaviour
    int health = 5;
    public void OnCollisionEnter(Collision collision)
        print("collison detected");
        if (collision.gameObject.tag == "PickAxe")
            print("Pick Axe hit");
            health -= 1;
            if (health <= 0)
                print("Object Destroyed");

none of the print commands are being triggered when I hit the box and can’t figure out why.
Any help is appreciated

Lets back up a second. Break it down to the bare necessities first. Set aside the pickaxe you are using and do the following.

Pickaxe Design

Make GameObject → 3D Object → Cube

Name = Pickaxe
Tag = Pickaxe
Layer = Default

Inspect the cube in the inspector and find the Collider component.

  1. Make sure it is enabled.
  2. Make sure IsTrigger is disabled.
    by default this is how it should be set up, but just check just in case.

Add: Rigidbody

  1. Disabled Gravity
  2. Eneable Kinematic.

Now, move the gameobject in the hierarchy so that it is a child of the VR controller. If you are using the Vive it will be like so [CameraRig] → ViveController(left or right) → Pickaxe. Oculus is pretty much exactly the same.

Pickaxe is ready. It will give physics data to fixedUpdate now and receive it’s movement data from the vive controller. i.e. It will follow the controller and tell the game engine it is smacking stuff. What you do with the smacks is what comes next.

MinedObject Design

Create GameObject → 3D Object → Cube
Name = MineableBlock
Tag = Block
Layer = Default

Check the collider in the inspector. A. Enabled? B. IsTrigger = false

Add Rigidbody

  1. Disable Gravity
  2. Set IsKinematic to true
    This will cause the game object to float in one place without being able to be moved by the physics engine however it will still exists to the physics engine every fixedUpdate. I.E. It can be hit.

Now create a C#Script

Call it Block
Put it on the Block (Dont forget to do this :D)
Open the script for editing and add the following.

private void OnCollisionEnter(Collision collision)
    if (collision.collider.tag == "Pickaxe")

Save the script. Hit play, and whack the block. Check the console for “OW!”

NOTE that we used, Collision.collider.tag, not Collision.gameobject.tag

If you add this instead, you will see why we do that.

private void OnCollisionEnter(Collision collision)


Try OnCollisionStay. And make sure that your tag is totally the same in your object that you want to collide with. And also try OnTriggerEnter or OnTriggerStay and change collisions to collider and check isTrigger who hold this script.