- Home /
Problem with Rigidbody2D.Addforce
Hi, i'm a total Noob so i would like an explanation and maybe a simple script written by you (?).
So... what's wrong with this script? It doesnt do anything.
#pragma strict
function FixedUpdate () {
if (Input.GetKeyDown(KeyCode.A))
rigidbody2D.AddForce(Vector2.up * 10);
}
Do you have a rigidbody attached to the gameobject this script is attached to?
Best way to help narrow the problem would be to use the debugger to check if the AddForce was called ? or add a Debug.Log("went here") in your "if" to check if the AddForce is executed.
Answer by xDevily · Aug 20, 2014 at 05:35 PM
check if you attacched a rigidbody2D not a rigidbody (3d)
Your answer
Follow this Question
Related Questions
Why can't I use RigidBody.AddForce and also have a collider? 3 Answers
Why doesn't my rigidbody.AddForce work? 4 Answers
uNet rigidbodies can't push each other 1 Answer
How can i initiate an object in parabolic motion without using gravity using Rigidbody2D? 1 Answer
rb.AddForce, rb.MovePosition, transform.localPosition: no solution working for 3D motion+collision 0 Answers