Jump to content

Detect unknown cast ray


Emilee Edenflower
 Share

You are about to reply to a thread that has been inactive for 2071 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?

Link to comment
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. 

Link to comment
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
Link to comment
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.   

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2071 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...