- Home /
Question by
Showny · Oct 18, 2015 at 01:37 PM ·
charactercontrollerjumpjumpingcharacter controllerheight
Player Inconsistent Jumps
Hey, when my player jumps, it's not always the same height. I can be 2 inches sometimes 10 feet. So, here's the script!
public float jSpeed = 5.0f;
public float gravity = 9.8f;
private CharacterController cc;
private Vector3 move = new Vector3(0, 0, 0);
void Start() {
if (GetComponent<CharacterController>())
cc = GetComponent<CharacterController>();
}
void Update() {
float jumpInput = Input.GetAxis("Jump");
//GRAVITY
move -= new Vector3(0, gravity * Time.deltaTime, 0);
// JUMP
if (cc.isGrounded){
move += new Vector3(0, jumpInput * jSpeed, 0);
}
cc.Move(transform.TransformDirection(move * Time.deltaTime));
}
Comment
Your answer
Follow this Question
Related Questions
I can't do that my character jumps while running 0 Answers
Jumping not always work 2 Answers
Shift BHOP in Character Controller 0 Answers
How to limit Jump Air Control (air surfing) 2 Answers
Fixed height jumping? 2D C# 1 Answer