sensor quesitons
|
|
Cito Karu
Registered User
Join date: 23 Jul 2008
Posts: 229
|
11-24-2008 12:33
Trying to understand this and get this working. the item supposed to read persons name from notecard (although this method can be changed) then look at that person when a dialog button is pushed to 'track person' ive been able to load the persons name into a notecard I then save person's name from notecard into variable performer this is a snippet of what i call the "lookat/track" code that works sorta. The problem is no matter what I do it always follows/tracks me and not the person I tell it to. on the first line I've tried performer with and without quotes both compile of course but it always follows me, not the person I tell it to. llSensorRepeat("", performer, AGENT, 20.0, PI, 0.1); } } sensor(integer total_number) { llLookAt(llDetectedPos(0) + <0.0, 0.0, 0.5>, 0.2, 0.3); This is mainly for object tracking, any tips to get a name from a notecard then have it follow that person instead of me would be greatly appreciated. i have no idea how no matter what I do on sensorrepeat it always follows me no matter what I do. so far at leat 
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
11-24-2008 12:50
Dunno why it's tracking the wrong person but it would be a lot easier on the sim to make this run on a timer with llGetObjectDetails instead of llSensorRepeat.. . . llSetTimer (0.25); }
timer() { list args = llGetObjectDetails (performer, [OBJECT_POS]);
vector pos = llList2Vector (args, 0);
llLookAt (pos + <0.0, 0.0, 0.5>, 0.2, 0.3); }
edit: also, if you _really_ want that .1 second response time, you're probably better just using a non-physical object and calling llSetRot. The movement won't be quite as smooth but it will be a lot nicer to the sim and, at the rate that you're doing these updates, nobody will notice anyway.
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
|
Cito Karu
Registered User
Join date: 23 Jul 2008
Posts: 229
|
11-24-2008 12:57
ok I wasn't aware of another way to get an avatar's position other than with sensor, since this auto tracks the person.
What this is for is I'm building stage lighting for concerts that auto track the performer.
edit- this is nonphysical object. it's a phantom nonphys object.
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
11-24-2008 13:09
The deal with sensors is that every time it fires, it gathers up everything that might possibly be returned by the llDetected stuff. With llGetObjectDetails, you can tell it that you're only looking for the position. It's a bit nicer on the sim..
As for why it's tracking the wrong person, I don't think anybody is going to be able to help there without seeing the code that determines which person it's supposed to look at.
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
|
Cito Karu
Registered User
Join date: 23 Jul 2008
Posts: 229
|
11-24-2008 13:21
this is the code
llSensorRepeat("", performer, AGENT, 20.0, PI, 0.1);
}
} sensor(integer total_number) { llLookAt(llDetectedPos(0) + <0.0, 0.0, 0.5>, 0.2, 0.3);
according to wiki llSensorRepeat i can set it to track 1 person not everything if you specify a specific avatar it will only keep track of that 1 persons position repeatedly.
which is what im trying to do.
sorta like the old Eyeball follower script that does pretty much same thing except it's touch activated.
here is the eyeball follower entire script -------------------------------------- key target;
default { on_rez(integer param) { llResetScript();
}
touch_start(integer total_number) { target = llDetectedKey(0);
llSensorRepeat("", "target", AGENT, 20.0, PI, 0.1);
}
sensor(integer total_number) { llLookAt(llDetectedPos(0) + <0.0, 0.0, 0.5>, 0.2, 0.3);
} } -----------------------------------------------------
this works perfectly for tracking 1 person only.
my previous script isn't working, im not doing a touch activated tracking, im passing it tracking target from a notecard with persons name.
|
|
Cito Karu
Registered User
Join date: 23 Jul 2008
Posts: 229
|
11-24-2008 13:41
actually I just figured it out... the eyeball script grabs the avatar's key on touch. but I have to give the sensor function the avatar's key not name. and since I'm having it read from a notecard I have to use the name2key script so i borrowed a part of the script from http://w-hat.com/name2keythat converts names into key's using online database. then I store that key into a variable and pass that NEW variable to the sensor script. now as I mentioned earlier it will track ONLY that key now. I guess talking it out and fighting with it, i happened to luck up across the solution
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
11-24-2008 13:44
Glad you found the bug!
/me would still change from using sensors to using a timer, though.
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
11-24-2008 20:57
You don't have to do a name-to-key lookup. Just use the name for the sensor (the first parameter to llSensor()llSensorRepeat(), not the second one).
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
11-24-2008 21:01
you might also want to be aware that you spotlighted performer is gonna have alot of fun trying to click anything from inside the beam.... just thought I'd mention that.
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Cito Karu
Registered User
Join date: 23 Jul 2008
Posts: 229
|
11-24-2008 22:44
yea Talked to an event hoster about what they would like as far as features. And I have added where it will track, stop tracking, as well as can reset position which moves the beam.
it's working out to be a pretty nifty item so far. Change color/animate on/of, track on/off, reset position, etc. all thru dialog box.
so its a nice effect for tracking if one wanted to use it for that, or can be stationary if wished, etc. just lots of options available for the user.
and some other options as well. I think it's turning out good, even if not it's a fun project learning "tracking" and stuff.
I didn't know that about the llsensor i can use name? I tried using avatar's name but it kept following me instead of the persons name I listed. It wasn't until i did a name2key and put that key into it did it start tracking the right person.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
11-25-2008 00:28
From: Cito Karu I didn't know that about the llsensor i can use name? I tried using avatar's name but it kept following me instead of the persons name I listed. It wasn't until i did a name2key and put that key into it did it start tracking the right person. The script in your original post is using the key parameter to filter the sensor, not the name parameter. What you want is 'llSensorRepeat(performer, NULL_KEY, AGENT, 20.0, PI, 0.1);' not 'llSensorRepeat("", performer, AGENT, 20.0, PI, 0.1);'. I don't know about tracking you, but as long as you have 'performer' assigned the name of the avatar you are looking for, the former should work fine. Note the signature of llSensorRepeat: llSensorRepeat(string name, key id, integer type, float range, float arc, float rate) See? You were passing 'performer' as the KEY of the thing you were trying to sense, not the NAME.
|
|
Cito Karu
Registered User
Join date: 23 Jul 2008
Posts: 229
|
11-25-2008 11:10
doh, i made a super easy thing into some over complicated mess using the key and name2key... lol thanks for pointing that out. For some strange reason (chalk it up to noobness) i thought sensors required avatar key, I may have read something wrong when looking it up. Thanks this makes it much much simpler use.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
11-25-2008 11:57
Note that once you find the avatar the first time, you have their key (just use llDetectedKey()). After that the suggestions regarding llGetObjectDetails() and timers and such are golden.
|