Hello! I’m having an issue with my killbox. Any script that I try applying to the plane below the scene doesn’t work. Any suggestions on code?
Don’t use a plane, use a box collider and don’t make it too small in height, otherwise if you fall fast you could “teleport” through it.
The code depends on your game mechanics. If you want the player or other things to get destroyed or “respawned” / teleported. However in general the boxcollider should be a trigger (isTrigger checked) and use:
// UnityScript
function OnTriggerEnter(aOther : Collider)
{
Destroy(aOther.gameObject);
}
If your player has quite deep nested colliders it’s better to use:
Destroy(aOther.transform.root.gameObject);
This will go up the hierarchy and destroy the top most object.