Spicked Trap Hole

I want to make a hole in the terrain (not a hole though it just a hole that the player can fall in) that causes instant death and maybe a custom animation with it (different from the normal death animation). the hole will be covered with a plane (with a suspicious left texture) that the player can fall though with spikes that the player can also fall though.

Pictured is what I’ve done so far[22276-trap+3.png|22276]

Any input is welcome

Theres a couple things to do that would make a cool effect.

First, I assume you have some sort of Player script, one that handles things the player does thats not movement and stuff? If not, make one. It will handle the player dying.

Add a box collider to the spike put to the dimensions you want and set it to Trigger. This means it will not act like a physical block, but it will still trigger when something touches it. Also a tag to the spikes called whatever you like, like “Spikes”

In your player script add the function [onTriggerEnter][1]. Inside it you can check whether the Trigger the player hit’s tag is “Spikes”. Using something like:

if(other.gameObject.tag == "Spikes")

Also create ragdoll of your character. Google how! Its really simple if you have a good model. Add a public GameObject variable to your player script then drag in the newly created ragdoll to that variable. In that if statement code, Instantiate the ragdoll at the same position and rotation as the player and then remove the player. You’re gonna have to handle what happens to the camera if the player disappears though. Maybe play a scream sound too for effect!

So what you will have in the end is your character will fall in the hole and on impact will go limp and flop over the spikes. Awesome!
[1]: Unity - Scripting API: Collider.OnTriggerEnter(Collider)