Jump to content

llCastRay and animesh objects


Estelle Pienaar
 Share

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

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

Recommended Posts

Hi everyone,

I am playing around with llCastRay. Trying to script a melee system with NPC oponents. That's why animesh objects would need to be detected. But llCastRay seems not to be able to detect animesh objects?

The following script is in a weapon that the avatar is holding. The ray is cast from the avatar (to the direction the avatar is facing) four meters forward. It works for all objects. But it does not detect animesh objects.

key ownerK;

default
{
    state_entry()
    {
        ownerK = llGetOwner();
        llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS);
    }
  attach(key id)
    {
           if (id)     
        {
            if (id != ownerK)
            llResetScript(); 
        
            else
            llRequestPermissions(id, PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION);
        }
        else
            return; 
    }

run_time_permissions(integer perm)
    {
        if(PERMISSION_TAKE_CONTROLS & perm)
        {
                llTakeControls(CONTROL_LBUTTON | 0, TRUE, FALSE);                 
        }   

    }
    control (key id, integer level, integer edge)
    {
        list rotL = llGetObjectDetails( ownerK, ([OBJECT_POS, OBJECT_ROT]));
        vector posV = llList2Vector(rotL,0);
        rotation rotV = llList2Rot(rotL,1);
        list results = llCastRay(posV, posV+<4.0,0.0,0.0>*rotV,[RC_DETECT_PHANTOM,TRUE,RC_DATA_FLAGS,RC_GET_ROOT_KEY,RC_MAX_HITS,1]); //I a have taken all possible filters out: RC_REJECT_TYPES,RC_REJECT_PHYSICAL|RC_REJECT_LAND|RC_REJECT_AGENTS
                
        key target = llList2Key(results,0);
        llRegionSayTo(ownerK,0,"HIT: " + (string)target + "."); 
    }
}

Am I doing something wrong or did LL forget to make animesh detectable by llRayCast? (well, I hope it is me...)

You should be able to copy the above script in any attachement and then do the test yourself.

Edited by Estelle Pienaar
Link to comment
Share on other sites

Are the animesh objects attachments to an avatar? Like all other attachments, they have no physics model and are not detectable via llCastRay.

My own animesh NPCs are definitely detectable with llCastRay; they avoid bumping into each other.

"llCastRay will not detect prims having no physics shape (PRIM_PHYSICS_SHAPE_TYPE = PRIM_PHYSICS_SHAPE_NONE)."

Can you walk through the NPCs you can't detect?

  • Thanks 1
Link to comment
Share on other sites

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