- Home /
Question by
CubicApocalypse · May 05, 2013 at 06:58 PM ·
forcespaceshiprocket
Apply force to object on keypress
How do I apply a constant force to a rocket when the W key is pressed?
Comment
Best Answer
Answer by Poptartica0 · May 05, 2013 at 07:40 PM
if(Input.GetKeydown("w"){
rigidbody.AddRelativeForce(0f,0f,thrust,ForceMode.Acceleration)
For constant force (i.e. applied each frame) it would be: Input.Get$$anonymous$$ey($$anonymous$$eyCode.W)
Your answer
Follow this Question
Related Questions
Adding explosion force knockback on player 1 Answer
Rocket Explosive Force 2 Answers
How to make thruster rotation 0 Answers
Force For Arrows 1 Answer
(Noob) How to stop force? (golfball) 3 Answers