Hello, I am creating a 2D room where the walls are box colliders. I have an object in the room that has a box collider and a rigid body component, I am changing the gravity direction based on the accelerometer. that works, but
It seems that i cant move the player (with the box collider) after it has rested on one of the walls, or touched 2 walls, like in a corner. is it constantly in a collision loop or whats going on. i want to be able to flip the accelerometer around again and it would drop down again, but it just gets stuck. when i try to change its location programmatically to some other place where its not touching the wall, it seems to move again.
Please post all of your code.
Answer by ryanbuddy1
Jul 15, 2011 at 02:13 PM
You will need to add force in the upward direction of your box when trying to move it as it is probably getting stuck in one of the walls of your level.
Put the below in script when you press a button to move your character and it should work:
rigidbody.AddForce (Vector3.up * 10);
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
1 Person is following this question.
Creating custom collision map for 2D from nodes
Multiple Stacked Colliders only register for single object
Collider2D/RigidBody2D not working
Unity 2D Colliders not Colliding
Ignore collision at high velocity.