Jump to content
Emilee Edenflower

Detect unknown cast ray

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

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

Recommended Posts

Cast ray is all very new to me so this may be a silly question, but is there a way to detect the "hit" from a cast ray weapon? The traditional collision detection obviously doesn't work, and from what I do understand (if I read it right) of cast ray, it operates on a channel number type of thing between the weapon and target to detect the hit?

So can you detect a "collision" if you don't know the original script of the weapon system for like a generic cast ray collision detection?

Share this post


Link to post
Share on other sites

IIRC, only the script that casts the ray gets any information.

When the ray is cast, it'll return everything that intersects that ray except the types of objects you've specifically set to filter out and up to whatever number of objects you've specified by max_hits. 

To use it in a weapon type scenario, you'd have to either create a secondary effect, like setting it as a particle system target, that the calling script would execute or tell whatever objects it detects that it has been "hit" with a llSay() and have the detected object's script react. 

Share this post


Link to post
Share on other sites
4 hours ago, Myrmidon Hasp said:

only the script that casts the ray gets any information

Correct. A script using a cast ray is simply asking the servers if there is something along the line of sight between the user and the target position.  If there is, the servers return the UUID and position of whatever is along the path.  Nothing is "hit".  There is no beam of particles or bullets.  It's a simple query to the servers.

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, Rolig Loon said:

Nothing is "hit".  There is no beam of particles or bullets.  It's a simple query to the servers.

Hmm, that's a shame. It'd be handy to be able to grab the "collision". Oh well!

Share this post


Link to post
Share on other sites
11 hours ago, Emilee Edenflower said:

from what I do understand (if I read it right) of cast ray, it operates on a channel number type of thing between the weapon and target to detect the hit?

As your comment suggests, you need to have the ray-casting weapon tell the target's HUD (or a scoreboard or whatever), using a channel. they share,  that it's hit the target.   

Share this post


Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 689 days.

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

Join the conversation

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

Guest
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.


×
×
  • Create New...