Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007812opensim[REGION] Script Functionspublic2016-01-14 16:482016-01-14 16:48
ReporterKayaker Magic 
Assigned To 
PlatformLinux/MonoOSOpenSim ReleaseOS Version0.8.2.1 Release
Product Version 
Target VersionFixed in Version 
Summary0007812: llCastRay V3 incorrectly gets a hit when start location is inside a sphere
DescriptionllCastRay normally does not get a hit on a prim when you start the cast inside the prim. This is convenient for many applications when you cast from the center of an object in any direction. In that case, you do not get a hit from the scripted object that does this.

Unfortunately, when you call llCastRay V3 with the start location anywhere inside a sphere, llCastRay DOES detect the prim the ray started from.

llCastRay V1 did not have this behavior.

llCastRay V3 also can get a hit when the start location is at the center of a prim that is a torus, a tube or a ring, but in these cases the hit makes sense.

llCastRay V3 correctly does not get a hit when the start location is inside a box, a cylinder, a sculptie or a mesh.

WORKAROUND: Replace your cannonballs with sculpted or mesh spheres. I'm particularly fond of mesh icospheres which look very nice with only 320 triangles (6 times fewer than a sculpt) and don't have a cowlick anywhere.

Steps To ReproduceCreate a box and place the script below inside it. Click on the box to start the test. (It takes 10 seconds because it is also doing a timing test). (Make sure there is nothing above the box that the cast might see). Note that the number of hits (nhits) is zero. Change the box into a sphere and click on it to run the test again. Note that the number of hits changes to 100, when it should still be zero. Offsetting the start location of the cast to different locations inside the sphere does not seem to change the result.

Additional Information        //llCastRay timing test
integer TIMES=100; //how many times to do the test
integer times; //how many so far
integer nhits; //how many hits
integer nerrs; //how many time llCastRay returned an error
integer htarg; //handle for llTarget
float ctime; //time spent in llCastray

    touch_start(integer num)
        llSay(0, "starting");
        times=0; //reset all the stats
        htarg=llTarget(<0,0,1000>,0.1); //use not_at_target as fast timer
        float start=llGetTime();
        list hits=llCastRay(llGetPos()+<0,0,0>,llGetPos()+<0,0,5>,[RC_DETECT_PHANTOM,FALSE,RC_DATA_FLAGS,RC_GET_ROOT_KEY]);
        ctime += llGetTime()-start; //accumulate time spent in llDastray
        integer err=llList2Integer(hits,-1);
        if (err>0)
            nhits+=1; //count hits
        if (err<0)
            nerrs+=1; //count errors
        times += 1;
        if (times>=TIMES)
        { //display results
            llOwnerSay("time per llCastRay call: "+(string)(ctime/((float)TIMES))+ " nhits="+(string)nhits+" nerrs="+(string)nerrs);
            llTargetRemove(htarg); //turn off fast timer
TagsNo tags attached.
Git Revision or version number
Run Mode Grid (Multiple Regions per Sim)
Physics EngineODE
Script Engine
EnvironmentMono / Linux64
Mono Versiontrunk
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2016-01-14 16:48 Kayaker Magic New Issue

Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker