- Home /
unity 5 game 2.5 trouble jumping
hi, i have this trouble with code o somethin my player when jump start fallin slow. i sumit an imagen of the components and my code of jumping
my code is:
if((Input.GetButtonDown("Jump") || Input.GetMouseButtonDown(0)) && grounded == true) {
GetComponent<Rigidbody>().velocity = new Vector3(0.0f, jumpForce, 0.0f);
anim.SetTrigger("Jump");
}
also change it to
GetComponent().AddForce(new Vector3(0, jumpForce,0));
but nothing happnes please help thanks
Answer by omarsolarte · Jun 01, 2015 at 09:30 AM
Ok right now finally found my mistake i dont know if the trouble is in my special case but i found the error
just to know the trouble was in the animator componet it was check the "Apply Root Motion" and my code is good
thanksss
Answer by Johnz1234 · May 29, 2015 at 11:39 AM
Try GetComponent().velocity = new Vector2(GetComponent().velocity.x,jumpForce);
Your answer
Follow this Question
Related Questions
How to make jump working 1 Answer
Anti-Gravity isn't working 1 Answer
Problem of gravity 1 Answer
Slowing down a fall from a Jump 4 Answers