|
Jexx Rayner
Registered User
Join date: 30 Jun 2006
Posts: 16
|
07-20-2006 14:56
I am using llSensorRepeat to periodically determine the avatars that are close ( within 10m ) of a specified object which contains the script, using PI/6 I can get just the ones that are close and more-or-less directly in front of the object, but is there a way to determine if they are facing the object? I am not sure whether I'd want to use the detected velocity, rotation or whatnot and what target values I'd be looking for.
Any help/tips would be greatly appreciated and if anyone knows of an example script I could look at that'd also be terrific!
Thank you, Jexx
|
|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
07-20-2006 15:05
Well, the forward vector of an avatar can be obtained with llRot2Fwd(llDetectedRot(f)). What you'd then want to do would be to check whether that was in the same direction as the direction to the object i.e. llVecNorm(llGetPos() - llDetectedPos(f)). You can use the dot product to see whether they are in the same direction: forward * dirToObject > 0.0.
|
|
Jexx Rayner
Registered User
Join date: 30 Jun 2006
Posts: 16
|
Thank you so much!
07-20-2006 15:14
Thank you for helping with that, and explaining each step of the calculations - I couldn't have asked for a better response...
Much appreciated! -Jexx
|
|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
07-20-2006 15:19
My pleasure!
Oh, and you might want to be careful with llSensorRepeat - there seems to be a big fat bug with it in the latest update that turns it off if you cross sims or teleport. You should be okay sticking to the same sim as far as I know.
|
|
Jexx Rayner
Registered User
Join date: 30 Jun 2006
Posts: 16
|
07-20-2006 15:25
Thanks for the tip - so that bug wouldn't come into play if the script were on a static object that is not attached/moving , right?  Jexx
|
|
Psyke Phaeton
Psyke's Defense Systems
Join date: 12 Oct 2003
Posts: 197
|
07-20-2006 22:27
Lindens doing sim restarts to fix llSensor() problems this might fix the llSensorRepeat() problems too. /3/20/122750/1.html#post1162083
|