#Snapping collisionbox properly for pixel-perfect collisions?

1 messages · Page 1 of 1 (latest)

undone edge
#

i enabled snap to 2d transforms and vertices for this thing, but i'm having trouble to actually align nodes such at the collisionbox properly to the sprite in pixel perfect. any idea how to work it properly?

delicate pier
#

Pixels are integers, positions are floats. So it isn't that simple to get them to line up.
Generally you don't want the hitbox to be exactly the size of the sprite. It just feels bad in-game.

undone edge
blazing pine
# undone edge Oh yeah? So it's never that precise at all?

yes! it's actually good practice to make the collision smaller than your sprite to give an illusion as if the sprite is actually contacting something. I usually use the circle/elipse one and make it like 1-2 pixels smaller than the characters

delicate pier
# undone edge Oh yeah? So it's never that precise at all?

I believe that in older games like with the NES, some games used pixels to check for collisions, so it was a 1:1. But it is far from ideal.

All modern games use smaller hitboxes because it just feels more responsive and "fair". Instead of having a a brick moving around :p

#

Same goes for 3D, even if you want it to be nearly 1:1, you shouldn't have a collision with the same mesh as the model. Mostly for performance reasons.

undone edge
#

But they were more pixel based, but chances is that if they get elaborated on execution there would be of course some optimizations

#

Since i'm actually trying to port a GameMaker project i was wondering how i was redoing the collision part

#

But then i'll try to make an aproximative collision by then,

timber drift
#

it's probably this

#

set x to 0

#

ok actually -1 probably but unless you want to change the collider when the player turns around, you don't want a horizontal offset

delicate pier
#

oh, i somehow didn't notice the inspector panel at all.