I'm trying to move a character upwards by a set amount when it touches a jump-pad. Here is the code so far:
var velocity : Vector3;
var jumpSpeed : float = 50;
var maximumSpeed : float = 30;
var minimumSpeed : float = 10;
private var controller : CharacterController;
function Awake(){
controller = GetComponent(CharacterController);
}
function Update(){
controller.SimpleMove(velocity);
}
function OnControllerColliderHit (hit : ControllerColliderHit){
if (hit.gameObject.name == "Jump") {
transform.Translate(Vector3(0,jumpSpeed,0) * Time.deltaTime);
}
Now, the problem is that this moves the character upwars (y-axis) by a certain amount in the space of 1 frame. How do I change this so it is over a longer time period?