Jump to content

help on collisions


Xed Saunders
 Share

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

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

Recommended Posts

hi, i'm trying to make a sort of racetrack where i've put a start/finish line prim, i've used on it llVolumeDetect(true) so it act like a phantom and a collision event  using llDetectedName(0) to get the name of the player crossing the line. all works flawlessy if i cross the start/finish line walking, if i use some kind of a vehicle the collision is detected with the vehicle and not with the avatar.
looking through the forum i've seen some examples of filtering collisions using this  if (llDetectedType(0) & AGENT_BY_LEGACY_NAME) but it still does not apply to my case because only the vehicle collision is detected not the avatar riding it
dunno if collisions can be filtered so only avatar collisions are detected? maybe i should use a sensor rather than a collision event?

Link to comment
Share on other sites

Exactly.  If you are seated, you have become the child prim in the object's linkset, so collisions are recorded the the linkset, not with you.  It's further complicated by the fact that your visible avatar is not its collision volume, so it's hard to say exactly where you are. It's easier if you just accept a collision with the vehicle.

Link to comment
Share on other sites

What i did, and more vehicles that are used i.c.w timing gates do is rename the vehicle to ##+avatar name when seated upon. that used to work with most timing gates.

And for vehicles that do not start with ## one could assume the owner of the object is driving it and you can use

llKey2Name(llGetOwnerKey(llDetectedKey(0)))

Edited by Kardargo Adamczyk
Link to comment
Share on other sites

thanks to all,  string player= llKey2Name(llGetOwnerKey(llDetectedKey(0))) ; did the trick, now i have to find how to modify the vehicle rezzer because the owner is the rezzer owner, not the toucher id, look like i can't use a simple

llRezObject("Object", llGetPos() + <0.0,0.0,1.0>, <0.0,0.0,0.0>, <0.0,0.0,0.0,1.0>, 0);
Link to comment
Share on other sites

If for any reason the seated avatar doesn't own the vehicle, you could get an agent list, and run a loop using llGetObjectDetails(agent,[OBJECT_ROOT]) to see if their root matches the detected object:

key agentonobject(key obj, list agents)
{
    integer len = llGetListLength(agents);
    integer i;
    for(i = 0; i < len; i++)
    {
        key agent = llList2Key(agents,i);
        list details = llGetObjectDetails(agent,[OBJECT_ROOT]);
        key root = llList2Key(details,0);
        if(root == obj)return agent;
    }
    return NULL_KEY;
}
default
{
    state_entry()
    {
        llVolumeDetect(TRUE);
    }

    collision_start(integer n)
    {
        key obj = llDetectedKey(0);
        if(llDetectedType(0) & AGENT)//detected a non-seated avatar
        {
            llSay(0, llKey2Name(obj) + " walked or ran through me");
        }
        else//an object passed through
        {
            key agent = agentonobject(obj,llGetAgentList(AGENT_LIST_PARCEL,[]));
            if(agent)
            {
                llSay(0, llKey2Name(agent) + " is seated on an object that passed through me");
            }
            else
            {
                llSay(0,"No one was seated on the object that passed through me");
            }
        }
    }
}

 

  • Like 1
Link to comment
Share on other sites

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