Jump to content

Detecting what's under the crosshair in mouselook?


Jenni Darkwatch
 Share

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

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

Recommended Posts

What's the accepted way to detect (by an attachment) what someone is looking at? Right now I use llCastRay, but that fails more often than it succeeds. On my home sim it fails 100% of the time in the last few days, even though the sim has a few ms spare time.

I tried llSensor, but that doesn't seem to follow mouselook, just the general direction the avi points at. The utterly last thing I want to do is rez a tracer.

Edited to add the specific code fragment:

list lHits=llCastRay(llGetCameraPos(),llGetCameraPos()+(<iScanRange,0,0>*llGetRootRotation()),
                           [RC_MAX_HITS,        iMaxRayHits,
                            RC_DETECT_PHANTOM,  TRUE,
                            RC_DATA_FLAGS,      RC_GET_ROOT_KEY,
                            RC_REJECT_TYPES,    RC_REJECT_LAND]);
integer iStatus=llList2Integer(lHits,llGetListLength(lHits)-1);
if(iStatus==RCERR_SIM_PERF_LOW)
    llOwnerSay("Could not detect object, the sim is too busy. Try again later.");
else if(iStatus==RCERR_CAST_TIME_EXCEEDED)
    llOwnerSay("Ray cast failed, cast time exceeded. Try again in a moment.");
else if(iStatus==RCERR_UNKNOWN)
    llOwnerSay("Unknown error during ray cast. This should be reported to LL.");
else {
// Rarely gets here.

 

Link to comment
Share on other sites

It was working fine till a few days ago, now all worn stuff returns a -3 error, drop it and it works fine, i dont use getrootrotation for the mouse look rotation, also why do you have "llGetCameraPos()+​(<iScanRange,0,0>*llGetRootRotation())" why the brackets, i am sure others would want to tell you how to get the mouse look rotation, as thats the rotation you need, but as you said that it did work i can only assume it does for you, i found it very unstable plus at 90 and 270 degress it starts to report the wrong rotation.

 

But what i am conserned about is all my deck guns they have been working fine for weeks, then 2 days ago they mess with cast ray and now all i get back is -3 if they are worn, funny how just as i say here i have done it that this should happen, wont ever post any info here again.

Link to comment
Share on other sites

The formula is a leftover from a previous experiment.  As are the brackets. Too bad that they broke llCastRay in attachments... I suppose the only workaround would be rezzing a prim that does the llCastRay and report it back to the attachment. Which of course... won't work in no-rez areas.

Oh well. Time to wait for LL to fix this.

Link to comment
Share on other sites

At the moment it does not seem to, no. I have a suspicion that it works once or twice per sim, but that the server never replenishes the pool for avis to use the call. See the section under RC_CAST_TIME_EXCEEDED in the llCastRay description in the LSL wiki for how it's supposed to work. Except that it doesn't. There's even a month-old JIRA on the issue: https://jira.secondlife.com/browse/SCR-243

Link to comment
Share on other sites

Personnaly i don t meet any problems with llcastray . Maybe your iMaxRayHits is too high , maybe your iScanRange is too high . Or maybe you spam llcatray without delay between two calls. Personnaly , when i couple llcastray with my camera , i save the old camera , and call llcastray only when the camera has changed . It avoids spam , but i don t know if it will satisfy your needs

Link to comment
Share on other sites

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