Collision Detection in non-physical items?
|
|
Nimbus Rau
Salmon pie? Where?
Join date: 15 Apr 2007
Posts: 292
|
11-24-2007 19:38
I'm currently making a gadget that generates a little critter every so often that will dash about madly for a minute or so before disappearing in a puff of sparkles. It mostly works ok... but I've so far failed to figure out how to get my little critter to cope with walls and other objects in its path. It just scuttles through them as if it were phantom (which it isn't). Events like collision or collision_start just don't seem to register at all when I use them.
Is it possible to get a non-phys item to detect an item in front of it or touching it? I'm hoping to avoid using physics for this task since my little critter contains more prims than the physics engine will allow.
What do folk recommend I do?
|
|
Melvin Rowlands
Registered User
Join date: 1 Sep 2007
Posts: 12
|
11-24-2007 21:33
You could use sensors to search for objects around the critter, and then move it accordingly
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
11-24-2007 21:46
give it whiskers and use in conjunction with volume detect... I think that might work for you
_____________________
| | . "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... | - 
|
|
Nimbus Rau
Salmon pie? Where?
Join date: 15 Apr 2007
Posts: 292
|
11-24-2007 23:59
From: Void Singer give it whiskers and use in conjunction with volume detect... I think that might work for you Could you expand on that a little? How will whiskers make it work better, assuming that the whiskers are also non-physical (which they'd have to be)?
|
|
Nimbus Rau
Salmon pie? Where?
Join date: 15 Apr 2007
Posts: 292
|
11-25-2007 00:02
From: Melvin Rowlands You could use sensors to search for objects around the critter, and then move it accordingly That would work for avoiding walls and such? The LSLWiki says: "The sensors detect objects only if their center falls in the detection cone (see below). This makes it harder to use sensors for pathfinding, especially avoiding big objects like walls." Is there a good workaround for this that you know of?
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
11-25-2007 02:41
From: Nimbus Rau Could you expand on that a little? How will whiskers make it work better, assuming that the whiskers are also non-physical (which they'd have to be)? the 'whiskers' would be sensing devices, probably 100% transparent, when they colide with an object they would return a collision eevent that could be used to trigger a change in direction. I'm pretty sure the object center doesn't need to pass through 'whiskers' to trigger the event. basic premise, object moves, whisker comes into contact with another object, collision is triggered, object takes actions until collision end is triggered. very useful for non-physics useage
_____________________
| | . "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... | - 
|
|
Nimbus Rau
Salmon pie? Where?
Join date: 15 Apr 2007
Posts: 292
|
11-25-2007 17:50
From: Void Singer basic premise, object moves, whisker comes into contact with another object, collision is triggered, object takes actions until collision end is triggered. very useful for non-physics useage Ah, gotcha! Yes, that does sound useful! I shall give it a go and see if I can get it to work. Thanks for the tip!
|
|
Nimbus Rau
Salmon pie? Where?
Join date: 15 Apr 2007
Posts: 292
|
11-25-2007 22:46
From: Void Singer give it whiskers and use in conjunction with volume detect... I think that might work for you Okay, my newt now has a whisker sticking out the front of its head. I can't get the dratted thing to actually do the collision detection thing successfully yet, though. Here's a little simplified testing script containing the collision code I'm using... what have I done wrong? default { state_entry() { llVolumeDetect(TRUE); llOwnerSay("checking for collision"  ; } collision_start(integer num_detected) { llSay(0, llDetectedName(0) + " collided with me!"  ; } } Note that it is in the root prim of the newt critter. I have another separate script providing forward motion; I'd anticipate that when the whisker started to interpenetrate an obstacle in front of the newt, this little script would trigger a message saying that collision had occurred. (I swiped the "collision_start" function directly out of the LSL wiki to avoid inadvertant typos.) But it's not working. I must be missing something here. Any idea what it is?
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
11-26-2007 01:19
From: Nimbus Rau But it's not working. I must be missing something here. Any idea what it is? You didn't miss anything... I did... uhm volume detect will only detect items with physics enabled... av's vehicles, etc.... I just rechecked it myself.... and now feel like an idiot physics of course would be the easy answer (except for the prim count) and you've already guessed the worst part of the sensor issue (it detects object centers)... I really don't see an easy way around this other than tailoring the environment, or preloading the limitis your critters can use.
_____________________
| | . "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... | - 
|
|
Nimbus Rau
Salmon pie? Where?
Join date: 15 Apr 2007
Posts: 292
|
11-26-2007 04:21
Darn.
Well, physics ain't really an option, since to get the prim count down to a level where that would be workable, my critter would lose its refined and newtly appearance. Although I could try and see if I could get it at least tolerable... *sigh*
I guess the other option is Plan B, which is to pass my Newt Emitter off as a Ghost Newt Emitter - now with amazing Walk Through Walls action! Not quite what I had in mind, but if I made the newts semi-transparent and added a ghostly sound effect, I could possibly get away with it. *wry laugh*
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
11-26-2007 04:54
sorry (but hey that's good marketing) .... why so high on the prim count these little newts? any possibility that some of their slick skin could be remapped with sculpty parts? texture hacks? terribly tortured torii??
_____________________
| | . "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... | - 
|
|
Nimbus Rau
Salmon pie? Where?
Join date: 15 Apr 2007
Posts: 292
|
11-26-2007 05:51
From: Void Singer sorry (but hey that's good marketing) .... why so high on the prim count these little newts? any possibility that some of their slick skin could be remapped with sculpty parts? texture hacks? terribly tortured torii?? It's coz of their animated walking action (done by duplicating the limbs and making them alternate between transparent and non-transparent, to a time). That and their cute little toesy-woesies.  I'll have a play with one tomorrow and see how much I can reduce the prim count by. I do already have a sculpty on it for a head. It's the limbs that are the challenge. But I shall see what I can do, later on.
|