Jump to content
Sign in to follow this  
Honza Noyes

Detecting headshots and other body parts

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.

Share this post

Link to post
Share on other sites



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.



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


Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...