Demons Souls Fall death Camera


I’m trying to achieve a certain affect for my players death when falling into a pit. Similar to demons souls, I’m attempting to make the camera stop in place after the player falls a set distance. The camera would then watch the player as they fall and the screen fades to black.

Ive got a basic setup for the screen fade but I haven’t a clue as to how I can approach what I’m going for.

#pragma strict
var falling: boolean = false; // tells when the player is falling
private var lastY: float;     // last grounded height
private var character: CharacterController;
var duration = 5.0; // fade duration in seconds

function Start(){
  character = GetComponent(CharacterController);
  lastY = transform.position.y;

function Update(){
  if (!character.isGrounded){ // if character not grounded...
    falling = true;        // assume it's falling
  } else {                   // if character grounded...
    if (falling){            // but was falling last update...
      var hFall = lastY - transform.position.y; // calculate the fall height...
      var timeinair = 0;
      var deathtimer = 10;
      		timeinair += Time.deltaTime;
      if (timeinair >= deathtimer){        // then check the damage/death
           Die();   // player is dead
    lastY = transform.position.y; // update lastY when character grounded
function Die(){
  // create a GUITexture:
  var fade: GameObject = new GameObject();
  // and set it to the screen dimensions:
  fade.guiTexture.pixelInset = Rect(0, 0, Screen.width, Screen.height);
  // set its texture to a black pixel:
  var tex = new Texture2D(1, 1);
  tex.SetPixel(0, 0,;
  fade.guiTexture.texture = tex;
  // then fade it during duration seconds
  for (var alpha:float = 0.0; alpha < 1.0; ){
    alpha += Time.deltaTime / duration;
    fade.guiTexture.color.a = alpha;
  //reload the current level:

I feel like I have to unparent the camera from the FPS, but im not sure.

Could you not, put a trigger collision where you want the camera to stop, and then use clamp to stop the camera moving any further?

Below will stop the gameObject from moving between -7 and +7 in the axis. Maybe modify this ?

horizontal = Input.GetAxis(“Horizontal”) * speed * Time.deltaTime;
vertical = Input.GetAxis(“Vertical”) * speed * Time.deltaTime;

var pos : Vector3 = transform.position;
pos.x = Mathf.Clamp(pos.x + horizontal, -7, 7);
pos.y = Mathf.Clamp(pos.y + vertical, -7, 7);
transform.position = pos;