Jump to content

Detecting headshots and other body parts


Honza Noyes
 Share

You are about to reply to a thread that has been inactive for 4266 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hello, I am unable to figure out how to properly detect the position where the object hit the avatar, situation is following:

Avatar is wearing a HUD, a bullet (for example 5m long one) collides with him, meter gets the llDetectedPos from collision_start event, however the llDetectedPos returns the bullet center, not the actual point where it collided with the avatar's hitbox. Shooting straight would work, but when shooting the projectile from different angles makes the reading wrong, since the center returned is no longer in the same height like where the collision happened.

I can quite safely detect the position by llCastRay function, but I would like to avoid that way. Thank you.

Link to comment
Share on other sites

hi,

 

llCastRay() was "introduced" to replace "physical type" like this for your exact purpose (ie. detecting individual prims or body parts)

the example on the wiki can be modified to be used in a weapon (and has been. i did but i'm not releasing the code)

 

if you go the llCastRay() route i would also back it up with a llSensor() call as it's a bit buggy in attachments.

then you use a particle bullet.

 

BUT

if you ABSOLUTLY want to go with physical bullets, in the bullet i would put a llCastRay() script with a small range (~1m)

and the a llRegionSayTo(llOwnerKey(),[stuff]) and do the calcs in a hud

 

just my 2$l

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4266 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...