- Home /
how can i make the jump responsive?
i have a player which jumps when the user clicks the button, i am calling the function from the button with the script rb.AddForce(-600f* Time.deltaTime, 0, 0); it works fine but i want the player to jump as soon as the player clicks the button, it feels like you can say a little lag. is there any way the player can jump as soon as the user clicks the button?
Answer by FlaSh-G · Jul 13, 2018 at 10:09 PM
The "On Click" event of a button is invoked when the button is released after being held down. If you want to react to the moment the button has been pressed down, do the following:
Add an "Event Trigger" component to the button GameObject.
Press the Button "Add New Event Type", then choose "PointerDown".
Put whatever you had in your button's "On Click" event into the "Pointer Down" event instead.
Answer by Jehy · Jul 14, 2018 at 04:32 AM
You need to apply the force immediately instead of applying it consistently as with AddForce(). This will give you the feeling of immediacy. One option is directly setting the upward rigidbody.velocity.y directly. Another option you could look into is adding an impulse force: Scripting API: ForceMode.Impulse.
Your answer
![](https://koobas.hobune.stream/wayback/20220612170645im_/https://answers.unity.com/themes/thub/images/avi.jpg)