Hitboxes

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
mattizz
Posts: 11
Joined: Sun Feb 24, 2008 11:39 am
Location: Poland, Gdansk

Hitboxes

Post by mattizz »

Hi,

we are making FPS game using irrlicht engine, but I need to know how to make hitboxes, you know, if you hit in the head damage would be eg. 50 torso 30, arms and legs eg. 10. Maybe someone had similar problem before?

Mateusz.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Well you can do ray collision against a bounding box of the head (if it's a seperate model you can just use the model's bounding box or if it's part of a complete model then you'd have to define the bounding box yourself and then update its transformation every frame, probably using a bone that you've placed in the model using a modelling program).

Or you can use a proper physics engine, but i guess that would require the same steps really.
Image Image Image
mattizz
Posts: 11
Joined: Sun Feb 24, 2008 11:39 am
Location: Poland, Gdansk

Post by mattizz »

Hi,

thanks for reply, I'm just modeller (and other stuff with graphics :P) programmer would like to know how to define bounding box using bone system. Examples would be very useful.

Mateusz
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Well firstly i'd suggest he come and post the questions rather than you as he's the guy doing the programming ;)

He'll need to use a model format that supports bones; ms3d and b3d do, not sure if they're the only ones but b3d is one of the best formats to use, so i hear.

For a head hitbox you'd have a bone in the centre of the head, maybe call it headHitboxBone or something and then in the code you can call the function which grabs the bone (check the API for the function name) by name and then you'd align your bounding box to the bone's transformation matrix each frame. You'd probably have to code your own bounding box class for this.

If you search the forum you should find other topics talking about bones for similar uses such as attaching weapons.

And note that this is only a solution off the top of my head so it may not be the best solution but it should do the trick i guess.
Image Image Image
mattizz
Posts: 11
Joined: Sun Feb 24, 2008 11:39 am
Location: Poland, Gdansk

Post by mattizz »

thanks for help JP, using bones to create hitboxes worked :)
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

Irrlicht could ease this with simply by giving a bounding box to the bone.
Using all the vertices attached to the bone....dunno maybe this already wokrs. didn't try it but ur coder could implement it :P
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
Post Reply