Damage Localization on an Actor

Hello All,

When an object (let’s say a spear) collide with an Actor , how can we get from the collision entry wich Bones/Part/Bunding Box of the actor is hit?
I mean (left_foot,right_arm…).

I was thinking of setting severals Tag or NetTag somehow on the actor but i’m not sure this is the most straighforward way to do according to panda design.

The tag interface is a pretty good and convenient way to do this sort of thing. This is one of the reasons the tag interface was developed.

You need to have each limb exposed as a separate node, and then call something like arm.setTag(‘bodyPart’, ‘arm’). Then when you get a collision, which gives you a collEntry, you can do: part = collEntry.getIntoNodePath().getNetTag(‘bodyPart’).

Note that getNetTag() is the same thing as getTag(), but it also checks the node’s parent(s) for the given tag until the tag is found.

David

Do you mean i have to use the egg-tochar thingy to expose my joint 's node from my actor ?

Right. egg-optchar, the name is short for “optimize character”, because one of its primary functions is to improve performance by eliminating unnecessary and unused joints from your model. But it can also expose a joint or a polyset for code manipulation.

David

"

Would you recommend egg-optchar every actor to improve performance?
is it better to do so before bamming?

Also if i keep one egg with skeleton and several with animation, should egg-optcahr all egg or only the skeleton one…

you are really a bible

I do recommend running egg-optchar on every animated model before bamming. It adds an additional step and complicates the model build process, but if performance is important it’s worth it.

You have to run egg-optchar on the model and all of its animations at the same time, so the program knows the complete set of animations that might ever be played on the model. (Also, since it will be removing joints, it needs to do this on all of the animations at the same time.)

This means that you probably don’t want to run egg-optchar in place and overwrite your source egg files, unless you want to regenerate all of your egg files every time you modify an animation or add a new one. Instead, you should keep all of your source egg files safe in one directory, and use egg-optchar to convert them together into a different directory. Then you can egg2bam all of the files in that output directory.

David