Disable First Person Controller upon death.

Hello all. I am having a problem disabling the character controller upon death. I want it so when the player dies, he can no longer jump.

I have a public bool playerDead = false. When the player collides with the enemy, playerDead = true. Unfortunately the character motor script as well as the FPSInput Controller script are both in Javascript, whereas the rest of my scripts are in C#.

The javascripts are both in the standard assets assets folder, so I have no idea why I can not reference them.

For future readers :

var characterController : CharacterController;
characterController = GetComponent( CharacterController );
characterController.enabled = false;

var characterMotor : CharacterMotor;
characterMotor = GetComponent( CharacterMotor );
characterMotor.enabled = false;

if(playerDead){
canControll = false;
}

then set canControll as a public boolean variable at the top of the first person controller. Then once the player dies you can no longer use the movement from the script

You can also try using Destroy(gameObject.GetComponent< CharacterMotor>();

I’m experiencing the exact same problem. The result I finally came up with was to simply set the player controller to inactive. This is a fairly simple feat to pull off, and if you don’t know how to do it already, let me know and I’ll explain it to you. However, the player can’t move as well as jump. If you are looking to only disabling jumping, I cannot help you. Your best shot would be to learn a smidgen of Java.