MantisBT - opensim
View Issue Details
0007375opensim[REGION] Script Functionspublic2014-11-16 15:262015-04-29 09:26
Kayaker Magic 
 
normalminoralways
newopen 
Windows .NETOpenSim0.8.0.1 post_fix
 
 
Grid (Multiple Regions per Sim)
ODE
.NET / Windows64
None
FireStorm
0007375: llCastRay does not treat physics type NONE prims as phantom
When RC_DETECT_PHANTOM is FALSE (which is the default) llCastRay is supposed to ignore phantom prims, volume detect prims, and prims with physics type NONE.

The first two are treated correctly, but physics type NONE prims are always detected.
Create two prims, link them together, use the build dialog to change the child prim to Physics Type NONE.
Create another prim, put the following script in it, wear the prim, go into mouse-look mode. Put the cursor on the first two prims above. Click the left-mouse button over each. The script should output the name of the root prim, but see the terrain through the physics type NONE prim. But instead, the child prim is detected by the llCastRay.
        //llCastRay Test
    setup()
    {
        if (llGetAttached()!=0) //if we are not already attached
            llRequestPermissions(llGetOwner(),PERMISSION_TAKE_CONTROLS | PERMISSION_TRACK_CAMERA);
    }

    default
    {
        state_entry()
        {
            llOwnerSay("reset");
            setup();
        }
       
        on_rez(integer param)
        {
            setup();
        }
       
        attach(key id)
        {
            if (id != NULL_KEY)
                setup();
            else
                llReleaseControls();
        }
       
        run_time_permissions(integer perm)
        {
            if(PERMISSION_TAKE_CONTROLS & 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))
            {
                rotation rot=llGetCameraRot(); //in mouselook, use direction you are looking!
                vector start=llGetPos()+<0.5,0,0.8>*rot; //start at avatar head level
                vector end = start+<256.0,0,0>*rot; //continue for 256 meters in that direction
                list hit = llCastRay(start,end,[RC_DETECT_PHANTOM,FALSE]); //detect anything on that line
                if (llList2Integer(hit,-1)>0) //if there was a hit
                {
                    key id=llList2Key(hit,0);
                    vector pos=llList2Vector(hit,1); //get the co-ord
     // llRezObject("dot",pos,ZERO_VECTOR,ZERO_ROTATION,1); //put a temp prim there
                    if (id==NULL_KEY)
                        llOwnerSay("Terrain");
                    else
                        llOwnerSay(llList2String(llGetObjectDetails(id,[OBJECT_NAME]),0));
                }
             }
        }

    }

No tags attached.
related to 0007546closed nebadon llCastRay only partly implemented 
Issue History
2014-11-16 15:26Kayaker MagicNew Issue
2015-04-29 09:26MagnuzRelationship addedrelated to 0007546

There are no notes attached to this issue.