how to detect collison on differnt body parts

hello, i want to make a shooter where there is differnt damage delt when a certain body part is hit (headshot is instant death, etc). so i was wondering how I would do this.

do some transperant reduced primitiv meshes around the parts you want to value. then you can use the panda collision detection or you write your own.


so i would put collision meshes on the different body parts in the modeling program?

You can use the standard panda3d primitives and attach them to your different body parts. They’re optimized for collisions. Attach a sphere to the head, another one to the body , cylinders to the arms, etc… ( To see what they look like in the renderer, do a It’s in the manual.

but if i have an animated actor would i have the collision cylinders (used for arms) move with the animation or would they stay in one place? and if i moved them then how would i move the cylinders to where the arms are when they move?

This stuff is in the manuals, so do a search before you ask.

First, If you’re using blender, label your parts and name them ( … x.html#3-6). If not, label them using egg-optchar from the panda toolset.

then find the part: theHead=self.character.find(’*/theHead’)
then attach a node to theHead: theHead.attachNewNode(CollisionNode(‘cnode’))

And then you have to learn how to search for collisions. But first, you have to understand parenting. When you attach a node to something else, it becomes a child of that node and acts like the parent. Think of a tree! Read the manuals, look up questions on the forum using search. Look at the sample tutorial on planets to find out how parenting works. You have a long way to go. Good luck!