- Home /
Character jump on collision
Hi Unity people, I could really use a bit of help. Im a bit of a noob when it comes to scripting so I apoligise in advance.
I am trying to expand upon the current 2d game tutorial. I am using the 2d character controller.
My goal is quite simple...
After the player has jumped (and is still in the air), if he comes into contact with a particular collider, if the jump button is pressed, Make him jump a bit higher, and play character animation.
Any scripting examples would be very welcome. Ive done a bunch of tutorials but cant find what im after and I have been at this one goal all day!
Thanks in advance guys!
RedWarriorKTF
Answer by asafsitner · Mar 17, 2012 at 10:57 AM
No need to apologize, we were all newbies at some point. :)
I'm not sure what your code looks like but the check for the jump button is probably `Input.GetKey()` which continuously checks if the designated key is pressed.
What you probably should do is change that to `Input.GetKeyDown()` which will only return true once, when the designated key is pressed, regardless of how long it is pressed.
Your answer
Follow this Question
Related Questions
character jump on collision with a box 0 Answers
Why can't my character jump 2 Answers
collision detection not working? 1 Answer
How to fix a infinity jump? 1 Answer