How can I get my script to recognise when a collider exits while the box collider of the trigger object is disabled?

My game has buttons which can be activated by placing cubes on top of them.

This works by using a trigger collider on top of the button. Ontriggerstay recognises that a cube is on top of the button
Then Ontriggerexit recognises when the box is no longer on top of the button

189347-help1.png

My script that allows players to pick up and move boxes.

This script disables the box collider of the movable box when you pick it up to prevent the box from colliding with objects in the scene as you move the box around. Without this line, the box spins around and picks up momentum.
189348-help2.png

The issue I’m having is that when the box collider is disabled, the ontriggerexit doesn’t trigger if the player moves the box off of the button by picking it up.

I either need:

  1. A way to recognise when the the box leaves the trigger collider of the button while it has no box collider currently enabled.

OR

  1. A alternative method to stop the carried box from spinning and picking up momentum without disabling the box collider.

Thanks.

Hi,

I believe Rigidbody.isKinematic might help you achieve option 2 in fact the example given in the documentation seems to be exactly what you’re after.