hitX = go.x_ > x ? go.x_ - x : x - go.x_;
hitY = go.y_ > y ? go.y_ - y : y - go.y_;
if (!(hitX > 0.5 || hitY > 0.5)) {
//register hit
}
What this code does is that it takes the coordinates of an object and a projectile and checks if the projectile is not further than 0.5 units in either direction. This means that the hitbox is a square, 1 unit by 1 unit in size, centered around the object.
Originally Posted by CrazyJani
Object size doesn't affect the hitbox.
Code from the client:
Code:
hitX = go.x_ > x ? go.x_ - x : x - go.x_;
hitY = go.y_ > y ? go.y_ - y : y - go.y_;
if (!(hitX > 0.5 || hitY > 0.5)) {
//register hit
}
What this code does is that it takes the coordinates of an object and a projectile and checks if the projectile is not further than 0.5 units in either direction. This means that the hitbox is a square, 1 unit by 1 unit in size, centered around the object.
And I am assuming there is no way to edit the size of this hitbox or maybe "move" the object so that wherever you shoot the client registers you being in that 1 unit hitbox?
thats like saying removing the texture of the enemy will automatically kill the enemy, you will just see projectiles coming from a ghost, and a red dot on the minimap.
Originally Posted by ReeceDaBeast
And I am assuming there is no way to edit the size of this hitbox or maybe "move" the object so that wherever you shoot the client registers you being in that 1 unit hitbox?