- Home /
Pushed objects randomly sliding into walls
I have a player, a bunch of 2D circles following it, and some walls. The scene is in "2D", with the sprites having 3D colliders extending downwards. I can push the enemy circles around, and while sometimes the walls block them from being pushed, sometimes [randomly] it does not, and they just slide into the walls. I googled a lot, and found out you should not use transform.translate for this - so I changed it to rigidbody addforce methods, but it still did not help.
Here is a picture of how it looks like:
Any ideas what could be causing the problem?
so is your player pushing the 2d circles around and then sometimes they get stuck in the walls? $$anonymous$$aybe you can explain it better.
If you select one, then in scene mode, you'll see the green collider. If may be going over/under the wall (so make things thicker) or being left behind (impossible normally, but depending how the red things were set-up and coded... .)
Thank you Owen, it helped! I have one more problem now tho, a part of enemy is dliging onto the wall, and then bumping out instantly - it happens continuously when it is being pushed against the wall - can I remove that effect? Can it be compltely solid?
And ALSO, connected enemy circles are applying friction to the player ... Say, there is a "tail" of enemies, each one touching another one, going all the way to the player, and also one of them touching the walls - the player slows down then, just like he was going sideways against the wall himself ... Which is really weird. I have tried changing physical$$anonymous$$aterials to have 0 friction, but it did nothing :/ It's kind of like one enemy was holding on to the wall, others holding on to each other to create a chain, and the last one holding player so he couldn't escape - while fun, it's not what I really want ...
Your answer
Follow this Question
Related Questions
2D Detect collisions of a 2D block only on left/right (not top/bottom) 0 Answers
Ignore collision at high velocity. 1 Answer
Change shape of object upon collision 1 Answer
Colliders in a wall jut out 0 Answers
Collision & 2D 2 Answers