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.
Hitboxes
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.
Or you can use a proper physics engine, but i guess that would require the same steps really.
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.
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.
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
Using all the vertices attached to the bone....dunno maybe this already wokrs. didn't try it but ur coder could implement it
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.