Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007810opensim[REGION] Script Functionspublic2016-01-14 14:412016-12-21 15:06
ReporterKayaker Magic 
Assigned To 
PlatformLinix/monoOSLinixOS Version0.8.2.1
Product Version 
Target VersionFixed in Version 
Summary0007810: llCastRay V3 detects phantom objects when asked not to.
DescriptionThe V3 version of llCastRay gets hits on phantom objects even when you request RC_DETECT_PHANTOM,FALSE
Steps To ReproducePut the following script in a prim. Put a target prim above it. Click on the first prim to start the test (it takes 10 seconds because it is also doing a timing test). Set the target prim to phantom and click the first prim to test again. Setting the target to phantom has no effect, it is still detected.

Create a third prim, link it to the target prim, use the build tools features tab to mark the child prim as Physics Shape Type None. Mark the target root prim as non-phantom. Position it so the child prim is over the prim with the test script. Click on the test prim to start the test again. It will detect the Physics Type None child prim even though it should not. (This was a bug in the older V1 llCastRay also).
Additional Information  //timing test for llCastRay
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
Kayaker Magic (reporter)
2016-12-16 14:47

I tested this again with castray V3, BulletSim and OpenSim 0.9 (OpenSim Dev OSgrid (Dev) 7c4f2b0: 2016-10-25 (Unix/Mono)). I tried it in a 1x1 and a 3x3 var with the same results:
This still fails on child prims, although it has been fixed for objects marked as phantom in the root prim. Below is a smaller program that makes it easier to reproduce the problem.

1) create two prims, link then together, mark the child prim as physics type NONE
2) create a third prim, put the following script in it
3) wear the third prim, go into mouse look mode
4) put the cursor on the type NONE child prim and click the left mouse button
It detects the child prim when it should not. Note: under ubODE without V3 castray, this experiment correctly does not detect the child prim.

  //llGetCamaraRot test
  // Put this script in a prim
  //wear it on left hand
  //go into mouse-look mode
  //aim and click left mouse button,
    attach(key id)
        if (id != NULL_KEY)
            llRequestPermissions(llGetOwner(),PERMISSION_TAKE_CONTROLS | PERMISSION_TRACK_CAMERA);
    } //attach

    run_time_permissions(integer perm)
            llTakeControls(CONTROL_ML_LBUTTON, TRUE, FALSE);
    } //run_time_permissions

    control(key avatar, integer levels, integer edges)
        if ((levels & CONTROL_ML_LBUTTON) && (edges & CONTROL_ML_LBUTTON))
                  //in mouselook, use direction you are looking!
            rotation rot=llGetCameraRot(); //in mouselook, use direction you are looking!
            vector start=llGetPos()+<1.0,0.0,1.0>*rot; //start at eye level in front of avatar
            vector end = start+<100,0,0>*rot; //continue for 100 meters in that dir
                                                        //detect anything on that line
            list hit = llCastRay(start,end,[RC_DETECT_PHANTOM,FALSE,RC_DATA_FLAGS,RC_GET_ROOT_KEY]);
            if (llList2Integer(hit,-1)>0) //if there was a hit
                key id=llList2Key(hit,0);
                string name;
                if (id==NULL_KEY)
                llOwnerSay("You hit "+name);
    } //control

UbitUmarov (administrator)
2016-12-16 15:33

made a few changes to llCastRay V3
made it ignore parts with physics shape type NONE as physics engines do.

watcher phantom is a linkset only flag. shape type is per part, except root and they will never be seen by physics engines. Phantom physical prims are seen and do collisions with terrain.

im sorry I had so chance to test this new code, so please do and let us know
Kayaker Magic (reporter)
2016-12-21 12:18

Still fails my test. I point the script from my last note at a phys shape type none child prim, click, and it still detects it. This is using castray V3 with BulletSim. (when I do the same test with ubODE and NOT using castray V3 the test correctly does not detect the 'none' child prim)

I finally got up to speed on compiling and running OpenSim from the git-go! (Many thanks to Andrew for helping me). So I am now running the latest version, the git log says:
commit e40820cab16500c6aac2aa25d1ea0cdc6725c392
Author: Melanie Thielker <>
Date: Tue Dec 20 17:01:48 2016 +0000
UbitUmarov (administrator)
2016-12-21 15:06

just tested your script in a region with bullet and V3 active.
on commit
SHA-1: 330369f90445bf7a017d25bbf8de647db9621f25
* take UserProfileModule out on onMakeRoot event, add some caching

And it does seem to not detect type NONE as expected
in edit linked mode set physics shape type to convex then None to make sure what you see on viewer is what you get.

- Issue History
Date Modified Username Field Change
2016-01-14 14:41 Kayaker Magic New Issue
2016-12-16 14:47 Kayaker Magic Note Added: 0031488
2016-12-16 15:33 UbitUmarov Note Added: 0031492
2016-12-21 12:18 Kayaker Magic Note Added: 0031496
2016-12-21 15:06 UbitUmarov Note Added: 0031498

Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker