Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Avatar, Object & Terrain Collision Detection

Nerolus Mosienko
Registered User
Join date: 3 Aug 2006
Posts: 145
02-23-2009 17:30
Hello all,

To best explain my situation, I'll put it simply like this:

Say I have a gun. This gun shoots bullets, just like most. At the moment, I've got a 3 particle systems and textures constructed.

- One particle system that represents bloodspray when the bullet hits an avatar
- One particle system that represents dust/shrapnel when the bullet hits a prim (object)
- One particle system that represents dirt when the bullet hits terrain.

So far I can only figure out how to use one generic system with llCollisionStart.

Would anyone happen to know how I can tell my script to recognize WHAT exactly it is hitting, thus triggering the correct particle system?

Any help with this is greatly appreciated, as it is currently twisting my brain in knots trying to figure it out and find out how to do it.

Thanks! :confused:
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
02-23-2009 18:03
For land collision http://wiki.secondlife.com/wiki/Land_collision_start
to detect if it an agent llGetAgentSize(llDetectedKey(0)) != ZERO_VECTOR)
you can either use an else or llGetAgentSize(llDetectedKey(0)) = ZERO_VECTOR
Nerolus Mosienko
Registered User
Join date: 3 Aug 2006
Posts: 145
02-23-2009 19:37
Hmm, well as I'm pretty newbie to scripting that /kinda/ makes sense. Thanks for your help. I tried integrating your advice a few ways but it doesn't seem to like that at all.

I've got a function that is triggered when the bullet collides with something, here is the function:

CODE

llSetStatus(STATUS_PHYSICS, FALSE);
llParticleSystem([ PSYS_PART_MAX_AGE, 0.100000,
PSYS_PART_FLAGS, 291,
PSYS_PART_START_COLOR, <1.00000, 1.00000, 1.00000>,
PSYS_PART_END_COLOR, <0.65000, 0.65000, 0.65000>,
PSYS_PART_START_SCALE, <0.52860, 0.52860, 0.00000>,
PSYS_PART_END_SCALE, <0.38567, 0.38567, 0.00000>,
PSYS_SRC_PATTERN, 2,
PSYS_SRC_BURST_RATE,0.451000,
PSYS_SRC_ACCEL,<0.00000, 0.00000, 0.00000>,
PSYS_SRC_BURST_PART_COUNT,2,
PSYS_SRC_BURST_RADIUS,0.000000,
PSYS_SRC_BURST_SPEED_MIN,1.510000,
PSYS_SRC_BURST_SPEED_MAX,0.010000,
PSYS_SRC_INNERANGLE,3.141593,
PSYS_SRC_OUTERANGLE,6.283185,
PSYS_SRC_OMEGA,<0.00000, 0.30000, 0.00000>,
PSYS_SRC_MAX_AGE,1.000000,
PSYS_PART_START_ALPHA,1.000000,
PSYS_PART_END_ALPHA,1.000000,
PSYS_SRC_TEXTURE, "MY TEXTURE UUID GOES HERE!!!",
PSYS_SRC_TARGET_KEY,(key)"" ]);
llSleep(0.25);
llDie();


I'm trying to add to this what I said above. If anyone can tell me where the commands go it might make a bit more sense to me.

Thanks again :)
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
02-23-2009 21:57
never used this, but it might help llDetectedType
http://www.lslwiki.net/lslwiki/wakka.php?wakka=llDetectedType
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369