- Home /
Question by
blackmethod · Jun 18, 2012 at 04:37 AM ·
rigidbodyforceslowadd
Apply force then slowly back off
I want to apply force to my ship then as the key is released, slowly back it off. It's a sidescrolling ship game if you get what I mean by it. So uparrow is pressed, it gets pushed up but after it's let go, it slows down to a stop, doesn't keep going, and isn't instantaneous
Current state
function Update () {
if (Input.GetKey (KeyCode.UpArrow)){
rigidbody.AddForce (Vector3.up * 100);
}
}
Comment
Answer by Exeed · Jun 18, 2012 at 04:44 AM
u can write say if the button is up then reduce the amount of the Gravity to this character :D
Answer by blackmethod · Jun 18, 2012 at 01:25 PM
Right, add drag then take it off. Can't touch gravity really as it's set to 0.
Your answer
![](https://koobas.hobune.stream/wayback/20220613072922im_/https://answers.unity.com/themes/thub/images/avi.jpg)