There also question. Do bullet check walls each 1 pixel or is higher value?
Forum
CS2D General Player hitbox/BulletPlayer hitbox/Bullet
7 replies 1
There also question. Do bullet check walls each 1 pixel or is higher value?
So the another question is still:
Do the bullets wall check every pixel or more?
1
if (abs(x - playerX) <= 12 && abs(y - playery) <= 12) { "IT'S A HIT!" }
Regarding general hit detection precision: It's not necessarily 100% pixel perfect but it should be close to it in most cases. The raycast kind of thing that's going on (the bullet) is moved Sin(rot) and -Cos(rot) pixels each iteration - with float precision until the max distance is reached or something stops the bullet. Simple as that. Not using any fancy algorithms like Bresenham or something. Therefore it might miss some pixels because of float precision etc.
edited 1×, last 10.05.24 07:12:08 pm
1