Jumping

Do you know how to make jumping by press button not hold??

umm, not sure i get what your meaning , but you should not have to hold a jump button to jump. That would seem to me , if you have to hold it down , that you would keep on jumping into the heavens O>o

can you send me example code with jumping :slight_smile: ?

I have done something like that is it correct ?

if(skok)
{
if(Input.GetKeyDown(“space”))
{
rigidbody.velocity = new Vector3(0,20,0);

}
}

}

void OnTriggerEnter()
{
skok = true;
}

void OnTriggerExit()
{
skok = false;
}

var speed : float = 1.0;
var jumpHeight : float = 1.0;
var gravity : float = 9.87;

private var direction : Vector3;
private var characterController : CharacterController;

function Awake(){
	characterController = GetComponent(CharacterController);
}

function Update () {
	if(characterController.isGrounded){
		direction = Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
		direction = transform.TransformDirection(direction);
		direction *= speed;
		if(Input.GetAxis("Jump")){
			direction.y = jumpHeight;
		}
	}
	direction.y -= gravity * Time.deltaTime;
	characterController.Move(direction * Time.deltaTime);
}