- Home /
Player's Collider Stuck Help
The blue bars are the walls of my game. The problem is that when the player(the green cube) is falling it gets stuck between the two walls colliders(that are aligned perfectly).. (the player and the walls have a box collider 2d) How can i resolve this? p.s. for this game i can't make a big collider which includes all the walls...
Show us your code, without seeing your logic, how will we help :(
Hack solution: Build in a tolerance, so that the falling object need not be quite so close to the wall, but close enough so the player will not notice.
You could use a Raycast to check whether there is space below the object to continue falling. If so, then continue to fall.
Alignment may be affected by imprecision of floats (and therefore Vector3s) depending on your implementation. See also http://docs.unity3d.com/ScriptReference/$$anonymous$$athf.Approximately.html
sorry i had not read your first comment! i can't show you the code of the player because i'm on another pc right now... i'll try what you said and i'll tell you how it went:))
Answer by GameGuy · Jan 08, 2015 at 11:03 AM
Same problem and solution inside here
http://answers.unity3d.com/questions/869959/rigidbody-stuck-on-collider.html
+1
@$$anonymous$$aco21 : Be sure to check out @Harshad$$anonymous$$'s comment (within link) too
Your answer
Follow this Question
Related Questions
Detect side of box collider 0 Answers
Why is my AI not thinking the collisions fast enough? 1 Answer
Character controller stuck in hole in wall 0 Answers
how to make a player die on collision 2 Answers
Collision between Player and a Wall 2 Answers