- Home /
player jumps too high when clicking with two fingers.
hello i'm making an android game where the player jumps everytime you tap on the screen.now the problem is when you click with two fingers he jumps soo high.i don't want that to happen.does anyone know how to fix this. i'm using Rigidbody2d.addforce
Answer by IggyZuk · Dec 31, 2019 at 09:52 PM
Are you using Input.GetMouseButton(...)
?
If you are, you should consider using Input.GetTouch(...)
. That way you can capture only one touch at a time.
no i'm using a button that covers the whole screen. and i use Event Trigger OnPointerDown(PointerEventData eventData) to detect the touch
Answer by Marioooo · Dec 31, 2019 at 11:28 PM
Use a timer in order to prevent from double jump. Also, to jump use
Rigidbody2D.AddForce(force, ForceMode2D.Impulse);
This way all the force is applied in one frame. If you don't specify force mode impulse, then the force will be applied within one second. This way also you don't need to use a very high force value to jump.
Hope it helps!
i'm already using Force$$anonymous$$ode2d.Impulse and still for some reason whene i tap with two fingers he jumps very high
Your answer
Follow this Question
Related Questions
how to make my character stay stable after hit? 2 Answers
my jump key works about once every 10 presses 1 Answer
Move an object via Rigidbody2D Physics and Transform at same time 0 Answers
Horizontal/Parabolic Projectil Movement and Jump for 2D //HELP! 0 Answers
Simple Rigidbody2D movement and jump 0 Answers