Hi everyone, i’m currently trying to make a character controller for a mobile game i’m developing, but i’m stuck figuring out how to make a smooth jump instead of the linear i have now, i need a smooth jump, just like the basic character controller from unity does.
This is what i have:
I have a button, to make the controller jump.
This is the script snipped out
private CharacterController player;
public float jumpSpeed=5f;
public float gravity=8f;
void Start()
{
player = GetComponent<CharacterController> ();
}
void Update()
{
if (jumpButton.IsPressed())
{
if(player.isGrounded)
player.Move(new Vector3(0.0f,jumpSpeed*Time.deltaTime,0.0f));
}
}
if(!player.isGrounded)
player.Move(new Vector3(0.0f,gravity*Time.deltaTime,0.0f));
}
How do you make a smooth, accelerated jump?
Thanks in advance