Forum

> > CS2D > General > Player hitbox/Bullet
Forums overviewCS2D overviewGeneral overviewLog in to reply

English Player hitbox/Bullet

7 replies
To the start Previous 1 Next To the start

old Player hitbox/Bullet

Mora
User Playing CS2D

Quote
I need player's hitbox values. Idk why but i thought is -11,-11,22,22 (or 22x22 square)

There also question. Do bullet check walls each 1 pixel or is higher value?

old Re: Player hitbox/Bullet

Ranu
User Off Offline

Quote
If I understand correctly, you wanna be checking the players hitboxes (even while they're moving) from the server? That'd be very unreliable either way.

old Re: Player hitbox/Bullet

Mora
User Playing CS2D

Quote
Yeah, I have already did test with debuglag 1.
So the another question is still:
Do the bullets wall check every pixel or more?

old Re: Player hitbox/Bullet

DC
Admin Off Offline

Quote
Yep 12 pixel distance. Or more precisely (pseudo code)
1
if (abs(x - playerX) <= 12 && abs(y - playery) <= 12) { "IT'S A HIT!" }
I think that makes actually 25 pixels? When taking a distance of 0 pixels into account?

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
To the start Previous 1 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview