Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

360 degree sensor for phantom attached sphere...

RyeDin Meiji
Reluctant Entrepeneur
Join date: 15 Mar 2005
Posts: 124
03-19-2005 12:24
Hi all, I'm new to SL.. I've got a phantom sphere that I will be attaching to myself, which i want to use to start creating a game. It needs to detect when anything comes within it (kind of like detecting collision, but for a phantom object). I started toying with llSensorRepeat but can't figure out how to sense something 360 degrees in all directions. Aside from that, I really don't think llsensor or llsensor repeat is what i want anyway because this sphere will have the ability to change size, so I'd constantly have to reset the sensing distance... any thoughts on something like a phantomcollison event?
RyeDin Meiji
Reluctant Entrepeneur
Join date: 15 Mar 2005
Posts: 124
03-19-2005 12:55
nevermind... I just found llVolumeDetect... told you I'm new.
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
03-19-2005 13:01
Hiya. "Phantom collisions" are called llVolumeDetect around here. It's a very handy little thing that does exactly what you need - detect when something comes inside it, firing a collision event.
Sadly it doesn't work on attachments. But yeah, you can use sensors. While llSensorRepeat constantly repeats the same sensor, with the same range, using the same interval, nothing prevents you from implementing your own SensorRepeat using a timer.
I assume you want to detect ACTIVE objects, like bullets.

Something like this:

CODE
float gRate=5.0; //scan every 5 seconds
float gRange=5.0; //scan a spherical volume 10m in diameter, like a 10x10x10 sphere prim

default
{

state_entry()
{
llSetTimerEvent(gRate);
}

timer()
{
llSensor("","",ACTIVE,gRange,PI); //PI ensures the "360-degree-ness" that you want
}

sensor(integer total)
{
//do your thing here

}
}



If your scale doesn't need to change too often, you can use llSensorRepeat, then llSensorRemove, and then llSensorRepeat with the new paramenters.
RyeDin Meiji
Reluctant Entrepeneur
Join date: 15 Mar 2005
Posts: 124
03-19-2005 13:07
nevermind AGAIN!!! Attachments cannot use llVolumeDetect?? ok, now please help. Does someone know how to do this? Attachments can't use llVolumeDetect... what a crock!
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
03-19-2005 13:08
Uh... you dont see my giant post up there? :)
RyeDin Meiji
Reluctant Entrepeneur
Join date: 15 Mar 2005
Posts: 124
03-19-2005 13:22
Thanks Eggy...

I tried a sensor with PI before I made my first post, but I was not getting the desired effects.. it was detecting some objects and not others. Is the sensor a plane? I need 360 degrees in all directions, and yes for detecting bullets and such...

llVolumeDetect would be absolutely perfect!
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
03-19-2005 13:55
From: RyeDin Meiji
it was detecting some objects and not others

Does your sensor call OR together ACTIVE, PASSIVE and AGENT, like this: ACTIVE|PASSIVE|AGENT?
Put that where eggy has ACTIVE in his script above, if you don't already have it.
==Chris
_____________________
October 3rd is the Day Against DRM (Digital Restrictions Management), learn more at http://www.defectivebydesign.org/what_is_drm
RyeDin Meiji
Reluctant Entrepeneur
Join date: 15 Mar 2005
Posts: 124
03-19-2005 14:03
yea, this is what I have:

llSensorRepeat("", NULL_KEY, AGENT|ACTIVE|PASSIVE|SCRIPTED, PI, 5, 1);

But to get that to work with any degree of accuracy is going to be a huge pain in my neck. This sphere could grow or shrink and there could actually be several spheres for one player... all the sensors would probably get a little laggy.

Right now I'm trying something out. I'm going to try to use getPos and setPos so the phantom sphere always stays with the AV even though it's not attached. Then collisions should work via llVolumeDetect.
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
03-19-2005 16:32
Umm... don't you know about the wiki? It explains sensors very well! With pictures!
http://secondlife.com/badgeo/wakka.php?wakka=llSensor
RyeDin Meiji
Reluctant Entrepeneur
Join date: 15 Mar 2005
Posts: 124
03-19-2005 17:04
... actually the sensor thing just won't work for my purposes. I need to detect collisions instantly (or as closely as possible).. using .1 seconds wouldn't even work very well, plus the sensor function itself is a little laggy (or so I've heard).

I finally got what I wanted though by using llVolumeDetect and making the sphere follow my AV when I touch it, keeping my AV in the center. I'll be tweaking this some, but it allows collision detection using the physics engine so I'm happy.

Thanks for your help though, Eggy.