managing collisions for a third person shooter game. help!

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
saeid
Posts: 4
Joined: Wed Mar 23, 2011 10:13 pm
Location: tehran , IRAN

managing collisions for a third person shooter game. help!

Post by saeid »

hi every one.
i am working on a third person game and i have problems with collision detection.
code is a bit of complex so i make it simple.
we have a bunch of animatedmeshes in the scene and we want to detect whether they are collided or not.
my solution was to check their boundig spheres first. if they hit then i check their aabb. so far it works just fine for me but when it comes too bullets i want to know were they exacly hit(for example to detect a headshot ).
i can use getSceneNodeAndCollisionPointFromRay(...) too find the tri but how do i know that what part of my mesh contains that tri?

(excuse me because of my poor english , i am persian) :D
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

You'll need to implement a hitbox system to register shots on different parts of a body, with every bodypart having a separate hitbox with their own damage values, etc.

Iterating through triangles would be too expensive to do frequently
ChaiRuiPeng
Posts: 363
Joined: Thu Dec 16, 2010 8:50 pm
Location: Somewhere in the clouds.. drinking pink lemonade and sunshine..

Post by ChaiRuiPeng »

you can easily attack them to the bones of the animated mesh scene node.

also maybe use an empty scene node for the actual collisions, but manually add a bounding box and set the points for however you need the shape/size
ent1ty wrote: success is a matter of concentration and desire
Butler Lampson wrote: all problems in Computer Science can be solved by another level of indirection
at a cost measure in computer resources ;)
saeid
Posts: 4
Joined: Wed Mar 23, 2011 10:13 pm
Location: tehran , IRAN

Post by saeid »

yes that would work but how can i assign a hit box to a part of my mesh(they are in .x format)?
if my mesh was made of some seperated parts ,using bones was good but in my case this is not posible .
ChaiRuiPeng
Posts: 363
Joined: Thu Dec 16, 2010 8:50 pm
Location: Somewhere in the clouds.. drinking pink lemonade and sunshine..

Post by ChaiRuiPeng »

saeid wrote:yes that would work but how can i assign a hit box to a part of my mesh(they are in .x format)?
if my mesh was made of some seperated parts ,using bones was good but in my case this is not posible .
im pretty sure format does not matter. format is just a way of storing the data. once it is loaded into irrlicht it is in all the same type (skinned mesh bones, that is, they all get converted ( i think... ) to

Code: Select all

IBoneSceneNode
type objects. since they are derived from ISceneNode, you can easily say, do
this

Code: Select all

bone_scene_node_instance->addChild(empty_scene_node_with_bbox_member);
ent1ty wrote: success is a matter of concentration and desire
Butler Lampson wrote: all problems in Computer Science can be solved by another level of indirection
at a cost measure in computer resources ;)
saeid
Posts: 4
Joined: Wed Mar 23, 2011 10:13 pm
Location: tehran , IRAN

Post by saeid »

hmm...
i think you are right about the format thing...
but still i dont know how to find the size of the bb im going to attach to my meshnode.
devsh
Competition winner
Posts: 2049
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

i would really advise irrBP or irrBullet or some other physics middleware
Post Reply