#Collider is offset in Y Axis (topdown 2D Game)

1 messages · Page 1 of 1 (latest)

echo blaze
#

The player collides fine with the wall on the X Axis.
On the Y Axis, if the Player moves from below against the wall it overlaps by about 1 Pixel.
If the Player moves from above against the wall it leaves about 1 Pixel space.

https://gdl.space/nubewumuji.cs Code for player

Att. Colliders

lyric tundra
#

Just use the built-in collider bruh

echo blaze
#

i have a box collider 2d on both objects

#

and in the code for the movement i use them

#

but now it seems to be using the pixels instead of the box collider

#

i found the issue, but dont know how to fix it

#

is there any variable of the offset of the box collider?

#

i figured it out: for the origin position of Physics2D.BoxCast you had to add the position of the gameobject to the collider offset (GetComponent<BoxCollider2D>().offset)