Author Topic: How do I perform hitdetection for headshots etc.  (Read 422 times)

Ok, so i was thinking of making some weapons that would have hitdetection, only problem is, I dont know how to do it, i know there are ways to do it with headshots, but I would like to know how you would go about doing it for other parts of the body aswell, and is:
Code: [Select]
if(isPackage(hitboxes) == true)
return; // Don't need duplicates.

package hitboxes
{
function getHitbox(%obj, %col, %pos)
{
$hitbox = true;
$hitboxList = "";

paintProjectile::onCollision("", %obj, %col, "", %pos, "");
cancel(%col.tempColorSchedule);
$hitbox = "";

%hitboxList = $hitboxList;
$hitboxList = "";

return %hitboxList;
}
function shapeBase::setNodeColor(%obj, %node, %color)
{
if($hitbox == true)
{
if($hitboxList $= "")
$hitboxList = %node;
else
$hitboxList = $hitboxList SPC %node;

return;
}
parent::setNodeColor(%obj, %node, %color);
}
};
activatePackage(hitboxes);
what I should be looking at?(I ripped it out of gcats firearms...)
For some reason I cant make heads nor tails of this, and it frustrates me.
« Last Edit: April 28, 2011, 06:57:56 PM by wizzlemanizzle »

So, what it looks like that script does is do a test with the paint can projectile at the point of impact, which is already able to detect the collided body part, and tells the rest of the code what body part was hit.  Then it fixes the node color.

Hope that helps