Reputation: 39
In Unity, I have a player where you press A and D to move left and right, and Space bar to jump (I am also trying to add touch controls). When I add a collider2d to my Player object, the object will not allow me to use Rigidbody2D.AddForce. It just doesn't move my character at all. Anybody know why?
PS: I know it is nothing with my input, because when I just edit the position directly (e.g. player.transform.position.y += 1
) it works, but it looks like the player is just teleporting so I don't want to do that.
Upvotes: 3
Views: 900
Reputation: 76
Maybe you can post some code or images of the settings of your player?
However, there may be many issues why its not affecting your player.
I hope this helps.
Upvotes: 0
Reputation: 1232
You need to set isKinematic property of RigidBody to false. Because If isKinematic is enabled, Forces, collisions or joints will not affect the rigidbody anymore. The rigidbody will be under full control of animation or script control by changing transform.position. reference to unity documentation http://docs.unity3d.com/ScriptReference/Rigidbody-isKinematic.html
Upvotes: 2