Problem with Collider2D in a TopDown 2D game


#1

Hello Aron,
I’ll try to explain my problem. I’m doing a 2D Top Down game where enemies will follow the player and attack him. All the pathfinding works perfectly, in fact my problem has to do with a CapsuleCollider2D on the feet of the enemies, that is set to collide with walls and obstacles. Since the point from where the path starts is in the center of the enemy (like in his chest), the movement starts from there, but the feets are colliding everywhere. Is there a way to move the point where the path starts?

In the image you can see where the path starts, I would like it to start from the feet instead.

Thank you for your great work with A* project!


#2

Nevermind, I managed to manually move the pivot of the gameObject to coincide with the starting point of the path, now it works perfectly!

EDIT: I’m sorry, but it seems that the problem is not resolved at all. I don’t know what I saw to wrongly realize it was working. Anyway, I now know that the path starts from the pivot of my game object, that is in the center of my character, regardless of where I try to manually move the pivot.

Well, I’ll make the same question as before: is there a way to move that starting point and not let it start from the pivot point of my character’s gameobject?


#3

Hi

I would suggest that you put the sprite on a child object and move that child so that the pivot of the character is at its feet.