setting LLSensor to scan in a half circle
|
|
Karen Ash
Registered User
Join date: 17 Feb 2006
Posts: 16
|
01-26-2007 07:04
I have a cube with the front vector on side 2. ( the default ) Im trying to make it so it only scans forward but it doesnt seem to work, I swore that it did at one time. Does anyone have any insights on how I can scan for agents just in one direction. I believe PI is half radius and TWO_PI is full radius. Thanks for any insights into my headache  I used somethign like this in the sensor repeat function but I dont have the code handy at the moment integer radius = PI; llSensor("", NULL_KEY, AGENT, 96, radius );
|
|
Stylez Gomez
Union Micro
Join date: 4 Jun 2004
Posts: 146
|
01-26-2007 08:07
A radius of PI will look around the whole object. To look around only the front of the object you should use PI_BY_TWO I believe. . ^ . \ | / If arc is x radians, \ | / the sensor will look for x radians \ | / around the object's forward vector, \ | / so the actual sweep of the search is \ x|x / 2x radians, and thus PI radians will \ | / search all around the object \|/
Wiki Link
|
|
Karen Ash
Registered User
Join date: 17 Feb 2006
Posts: 16
|
01-26-2007 11:23
Thanks, I tried the Two PI constant also but the prim sensor still sees me when im behind it, I am going to try to hard code the PI part of the function, right now its a variable, probally some silly mistake,
Thanks for verifying that for me
|
|
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
|
01-26-2007 11:44
PI is 180 degrees.
llSensor's arc is that angle in all directions from the forward axis. So, PI would mean a full sphere around the sensor. PI divided by 2.0 is 90 degrees, which will be a forward-facing half-sphere. Think of it in terms of a mirror. The arc may only be 90 degrees, but it is mirrored in all directions, making it a 180-degree field of view facing forward.
PI times 2.0 would still be the full sphere, since PI is already the full sphere. Thus, the maximum reasonable value for the arc is PI radians.
|
|
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
|
01-26-2007 17:05
You're stuck with a cone of detection, so the further you are from the sensor, the less 'in-front' you have to be. You can scan forwards only with PI_BY_TWO, but the sensor will also detect above/below, and left/right of the prim. If you want to narrow the cone, divide PI by a larger number, like PI/16 or PI/32.
Yet another option, go ahead and scan at PI/2 (half a sphere), then use llDetectedPos() and math to calculate whether or not the target is within whatever bounds you wish to limit detection to.
|
|
Karen Ash
Registered User
Join date: 17 Feb 2006
Posts: 16
|
Eurekea
01-26-2007 17:49
Thanks VERY much to all of you, Your advice has been VERY helpful. I am playing with it now and will hopefulyl have something fun to post here soon  now llDetectedPos() and math to calculate whether they are still inside the cone Now that little bit I wouldnt know where to begin, Ill see if I can find me a smart person for that bit  thanks for bringing that up  I really do appreciate all your kind advice
|
|
Jopsy Pendragon
Perpetual Outsider
Join date: 15 Jan 2004
Posts: 1,906
|
01-26-2007 18:49
For fun, I created a gizmo that displays, with particles, the sensor arc, range and interval of a set of llSensor / llSensorRepeat() parameters... I'll add it to the Particle Laboratory Extension later tonight 
_____________________
* The Particle Laboratory * - One of SecondLife's Oldest Learning Resources. Free particle, control and targetting scripts. Numerous in-depth visual demonstrations, and multiple sandbox areas. - Stop by and try out Jopsy's new "Porgan 1800" an advanced steampunk styled 'particle organ' and the new particle texture store!
|
|
Stylez Gomez
Union Micro
Join date: 4 Jun 2004
Posts: 146
|
01-26-2007 19:47
From: Jopsy Pendragon For fun, I created a gizmo that displays, with particles, the sensor arc, range and interval of a set of llSensor / llSensorRepeat() parameters... I'll add it to the Particle Laboratory Extension later tonight  Wow, I could have used that yesterday! I ended up making my own particle system that shows range. lol I'll have to take a look at yours when you put it up.
|
|
Jopsy Pendragon
Perpetual Outsider
Join date: 15 Jan 2004
Posts: 1,906
|
02-01-2007 13:19
From: Stylez Gomez Wow, I could have used that yesterday! I ended up making my own particle system that shows range. lol I'll have to take a look at yours when you put it up. It's there... on the off-shoot branch of the lab... I keep intending to add button controls to adjust range/arc/interval.
_____________________
* The Particle Laboratory * - One of SecondLife's Oldest Learning Resources. Free particle, control and targetting scripts. Numerous in-depth visual demonstrations, and multiple sandbox areas. - Stop by and try out Jopsy's new "Porgan 1800" an advanced steampunk styled 'particle organ' and the new particle texture store!
|