I’ve been following the Making Enemies lecture, tried to match the colliders as delicately and as precisely as I can, but when the enemy reaches a wall, he gets stuck to it, glitching between facing right and left, and a part of the sprite is behind the wall tiles
Hi Jonathan,
Could you share a screenshot of the enemy’s collider(s)? Its little foot must have an offset from the rest. Otherwise, the other collider collides with the wall and makes the enemy flip.
Move the little collider a bit farber to the right.
If the issue persists, pause your game and click on the “forward” button to go to the next frame. While doing that keep your scene window open to see what game objects the colliders are touching.
Okay, by further inspecting this, I found that the ground check collider does collide with the tilemap and the sprite flips even before the capsule collider touches the tilemap collider.
It flips pretty much just after the entire ground check collider is overlapping the tilemap one.
another problem arised. I got the enemy to not clip when it hits the wall on it’s right, but the left has bigger clipping, and a weird collider outline
That screenshot is helpful. It shows the infamous problem with the tilemap collider. Actually, the edge collider should be a nice line around the overall shape of the “terrain”, not around single blocks. Disable the Tilemap collider and enable it again. If you get a proper edge collider, play your game again.
Just did, it gives the same result as before.
Does the edge collider look as it is supposed to look or is there still this funny shape?
If there is still that shape or a similar one, remove all colliders from the Foreground game object and reassign the colliders.
This topic was automatically closed after 19 hours. New replies are no longer allowed.