Jump to content

How to tell what avatar sitting on ANOTHER object


Restless Swords
 Share

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

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

Recommended Posts

Think of a car-race system, several avatars sitting in/on cars driving around a track.  you create a timer "gate" accross the track.  some arbitrary car object collides (passes through) timer object. The timer object/script can get the cars key, and can then get various car object data. 

Is there anyway that the timer script can use the car objects key and then determine WHO is sitting in/on it ?

- to display lap times using drivers name

NOTE: car objects are not controlled,they  can be from anywhere, and have scripts in them developed by others.

Link to comment
Share on other sites


Dora Gustafson wrote:

If you assume the vehicle is owned by the driver
will provide the driver's key

One of the problems is that there are also loaner vehicles that anyone can use (and many do).

- i went down that "GetOwner" road and had to give up because so many drivers vs owners were different

 

But Cerise had a fine idea i had not thought of.

 

Link to comment
Share on other sites


Cerise Sorbet wrote:

You can do it from the other direction. Check the avatars on the parcel with OBJECT_ROOT from llGetObjectDetails, this will tell you what they are sitting on. Then you can match it up with the objects you are tracking.
 

This is a really interesting idea, from a direction that had not occured to me.

- I will certainly give it a try, it sounds very promising

UPDATE:

Tried it and got it working.  due to the delay and load of fetching sim Avatar list, i just do this and cache it (updating regularly)

 

Link to comment
Share on other sites

here is an example with llCastRay

http://wiki.secondlife.com/wiki/LlCastRay

try it with a 0.02 sec timer mebbe? .. this will cast a ray 3 meters to the left?

 vector start;
vector floor;
vector offset;
vector adj;
list name;
key keynm;
string Vname;
list vec = [];

 

 timer()
    {  start = llGetPos();
       list results = llCastRay(start,start + <0,3.0,0>,

      [
        RC_REJECT_TYPES ,  RC_REJECT_LAND | RC_REJECT_PHYSICAL | RC_REJECT_NONPHYSICAL,     
        RC_MAX_HITS, 1,
        RC_DETECT_PHANTOM,  FALSE
       ]);     
       
       name =  llList2List(results,0,0);
        keynm = llList2Key(name,0);
        Vname = llKey2Name(keynm);
       vec = llList2List(results,1,1);
       floor = llList2Vector(vec,0) ;    
       offset = (start - floor);
       adj = <0.0,0.0,0.5>;    
      if(vec)
      { llSay(0,"Avatar Detected: " + Vname);
      }
    }

Link to comment
Share on other sites


Xiija wrote:

 

here is an example with llCastRay

try it with a 0.02 sec timer mebbe?

RayCast was an interesting idea but i dont think it is workable

  • if i set the timer fast enough to detect avatars in speeding cars it is a LOT of RayCast time, mostly unused
  • and it is not even possible to always catch speeding avatars even at 0.1 sec timer
  • if instead of timer i use CollisionStart that is usually the front of a car, and usually misses the avatar
  • and if CollisionStart is used to do 10 or 20  0.1 sec timers, it still sometimes misses speeding avatars

So, a nice idea but RayCast doesnt seem to be workable for speeding cars.

Link to comment
Share on other sites

Cerise's suggestion is much nicer anyway because you can drive it from llGetAgentList, updated whenever you get 'round to it. But if one absolutely had to use raycasting for some reason, it should be possible to combine it with the initial idea of an llVolumeDetect "gate" to get the UUID of passing vehicles, then raycast right through them in their direction of motion (if physical, OBJECT_VELOCITY, else a bit of geometry). Even then, though, there's no certainty of the ray hitting the avatar, especially for vehicle designs that dramatically offset the avatar's physical bounding box from its animated in-vehicle appearance.

Link to comment
Share on other sites

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