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
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.
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:
- A way to recognise when the the box leaves the trigger collider of the button while it has no box collider currently enabled.
- A alternative method to stop the carried box from spinning and picking up momentum without disabling the box collider.