- Home /
Colliders2d not colliding, yet stoping the rigibody2d.
Hi, I have a very weird problem dealing with colliders2d
and rigidbody2d
. Kind of similar to this question Problem with colliders2D with GameObjects
I have a gameobject
with rigidbody2d
and boxcollider2d
attached to it (lets call it "Player"). I am moving that object by AddForce
method on top of other gameobjects
in the world which only have boxcolliders2d
attached to them. But at times my Player stops moving as if it is colliding with a gameobject
and cannot move further ahead. Here are the images for it. I will explain more via images.
Both are images of same scenario. First Image is a bit zoomed out. And Second is zoomed in at the direction my Player is moving. Now the thing is my player is stuck there. And will be stuck there, unless I move my Gameobject 1 or Gameobject 2 a bit upward (increase their Y from even from the inspector). Or move Gameobject 3 a little downwards. Till I wont do that, my player is stuck there. I know this is a very weird problem and more information might be required. So, if you need to know anything else in the scenario, please do let me know. I would be very thankful if some1 help me to fix this problem. Thank you in advance.
Probably your gameobject 1 is hitting the edge of gameobject 3. If it is possible you can make gameobject 2 and 3 one single gameobject. If it is not, you can play with collision penetration threshold values from here: http://docs.unity3d.com/$$anonymous$$anual/class-Physics2D$$anonymous$$anager.html $$anonymous$$odifying addforce value might help too.
yes that is my take on that also, but i have zoomed in as shown in images and they dont seem to be colliding and y value of gameobject 2 and gameobject 3 is same. I will check the link you told. Thank you for replying
Answer by Ali-hatem · Oct 28, 2015 at 10:32 AM
1.in 2d even if the player is above the other game objects it will be considered like they face each other so the (Z) index doesn't matter.
2.now if you want the player to move above objects it will be moving throw them so you have to set objects box collider to triger in hierarchy.
Thnx for replying but what are you talking about ? What does Z index have to do with any collisions in 2d ? You did not make any sense in your two points, or I did not get them at all..... :|
@Abdul91! man this is what a im talking about " Z index have nothing to do with any collisions in 2d " read my replay .
Your answer
![](https://koobas.hobune.stream/wayback/20220612043029im_/https://answers.unity.com/themes/thub/images/avi.jpg)