- Home /
Question by
Aduanvesh · Mar 01, 2014 at 04:26 AM ·
rigidbody.addforce
Rigidbody2d
how do you use rigidbody.addforce with rigidbody2d. here's what i have now:
function Update () {
if (Input.GetKeyDown(KeyCode.UpArrow)){
rigidbody2d.AddForce(0, 10, 0);
}
}
Comment
Your question as is doesn't make much sense. You cannot have a Rigidbody and a Rigidbody2D on the same game object. If you are asking why the code above is not working, it may be that you are adding too little force. Either up the force or change the Get$$anonymous$$eyDown() to Get$$anonymous$$ey() so that forces is applied over many frames.
it still doesn't work it says 'rigidbody2d' cannot be identified
Your answer
Follow this Question
Related Questions
Physics in 2D mode not working? 0 Answers
ForceMode.VelocityChange vs. simply adding to .velocity 0 Answers
Basic Jump Pad help 2 Answers
rb.addforce being really buggy 2 Answers
Gameobject going past target when using rigidbody2d.addforce 1 Answer