#Snapping collisionbox properly for pixel-perfect collisions?
1 messages · Page 1 of 1 (latest)
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.
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
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.
If i am comparing to another engine, GameMaker, GameMaker used masks as default collision
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,
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
oh, i somehow didn't notice the inspector panel at all.