Wall Jumping Help

I’ve been trying to figure out a way to put in a simple wall jumping system for my platformer. I was trying to use OnControllerCollider hit to detect wall collision with tags, the only problem is making the player jump in the opposite direction of the wall in the “WallJump” function. Can anyone help?

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

function Update(){
	if(controller.velocity.sqrMagnitude < 0.1){
       //animation.CrossFade("IdleAni");
	}
	if(controller.velocity.sqrMagnitude > moveSpeed){
		moveSpeed = moveSpeed; //Limits excess directinal speeds by multiple button presses
	}

	forward = Camera.main.transform.TransformDirection(Vector3.forward);
	forward.y = 0;
	forward = forward.normalized;
	right = Vector3(forward.z,0,-forward.x);
	h = Input.GetAxis("Horizontal");
	v = Input.GetAxis("Vertical");
	
	//MAINTAIN Y OF MOVE DIRECTION
	var XZmoveDirection:Vector3 = (h * right + v * forward);  
	XZmoveDirection *= moveSpeed;
	moveDirection.x = XZmoveDirection.x;
	moveDirection.z = XZmoveDirection.z;
	 
	if(controller.isGrounded){
		canDoubleJump = true; 
		if(Input.GetButtonDown("Jump") && canJump){
			Jump();
		}
		
		if(Input.GetKeyDown(KeyCode.LeftShift) && dash){
			Roll();
		}
	}   
	if(!controller.isGrounded){
		if(canDoubleJump && canJump && Input.GetButtonDown("Jump")){
			DoubleJump();
		}
		
		if(Input.GetKeyDown(KeyCode.LeftShift)){
			AirDash();
		}
	}
	if(XZmoveDirection != Vector3.zero){
		var rotation0 = transform.rotation;
		rotation0.SetLookRotation(new Vector3(moveDirection.x,0,moveDirection.z) * rotateSpeed);
		transform.localRotation = rotation0;    
	}
	if(!controller.isGrounded){
		moveDirection.y -= gravity * Time.deltaTime * 2;
	}
		controller.Move(moveDirection * Time.deltaTime);
}

function OnControllerColliderHit(hit : ControllerColliderHit){
	if(hit.collider.tag == "Wall" && !controller.isGrounded && Input.GetButtonDown("Jump")){
		WallJump();
	}
}

function WallJump(){
	//WHAT DO I PUT HERE?!
}

The ControllerColliderHit object has vector data about the direction of the collision. Pass collision vector into the walljump function.

  1. Add jumpUpAmount x Vector3.Up to the collision vector. By changing jumpUpAmount , you can change the angle of the jump.
  2. Normalize the resulting Vector.
  3. Multiply that by jumpPower.
  4. Apply the final vector as an instantaneous force to the controller.