Hey, I was trying to work out how to add jumping and I couldn't get it to work. :/
These are the vars at the top of my script:
private var moveDirection : Vector3 = Vector3.zero;
var JumpSpeed = 8.0;
var gravity = 20.0;
and this is in the function:
//Apply gravity
moveDirection.y -= gravity * Time.deltaTime;
//Jump
if(Input.GetButtonDown("Jump"))
{
moveDirection.y = JumpSpeed;
}
Is this the right way to go about this? is there a better way? Should the player have different components?