Hi, Im trying to make a kind of isometric platformer game. My main character is using a character controller. I got the movement and rotation right (with alot of help im still learning unity) but im having problem with jumping. I tried everything i could think of, searched for hours but no solution is working for me. If i add the normal jump code my character just teleports to jump height and then start falling down. Here is my code:
void Update()
{
Vector3 input = new Vector3 (Input.GetAxisRaw ("Horizontal"), 0, Input.GetAxis ("Vertical"));
if (input != Vector3.zero)
{
targetRotation = Quaternion.LookRotation (input);
transform.eulerAngles = Vector3.up * Mathf.MoveTowardsAngle (transform.eulerAngles.y, targetRotation.eulerAngles.y, rotationSpeed * Time.deltaTime);
}
if (Input.GetKey (KeyCode.Space) && cc.isGrounded)
{
input.y = jumpSpeed;
}
motion = input;
motion *= runSpeed;
//motion += Vector3.up * -8;
motion += Physics.gravity;
cc.Move (motion * Time.deltaTime);
}
I have been experimenting with jumping part but i cant get the right jump that would working with my controller… please help i have been looking for hours and i really want to learn.
Thank you