Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

collision

Ava Velde
Registered User
Join date: 17 Jan 2009
Posts: 310
06-19-2009 01:33
collision script ~ avatars bump ~

Are there some suggestions?
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
06-19-2009 02:01
Make a script that starts playing a sound when the collision event happens.
Put the script in a prim
Attach the prim to your Avatar

See:
http://www.lslwiki.net/lslwiki/wakka.php?wakka=collisions
and:
http://www.lslwiki.net/lslwiki/wakka.php?wakka=sound
(if you wait a little longer someone in the forum is going to give you a free script I bet:D)
_____________________
From Studio Dora
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
06-19-2009 10:03
Well, you'll probably want to filter on the type of the thing you collide with. Something like (in an attachment):

CODE

string SOUND = "mySound";
float VOLUME = 0.5;

default
{
collision_start(integer nDetected)
{
integer i;
for (i = 0; i < nDetected; ++i)
{
if (llDetectedType(i) & AGENT)
{
llPlaySound(SOUND, VOLUME);
// Or perhaps llTriggerSound(SOUND, VOLUME);

// Play sound just once for entire collision
return;
}
}
}
}


EDIT: Otherwise you could just use llCollisionSound(). See http://www.lslwiki.net/lslwiki/wakka.php?wakka=llCollisionSound
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
06-19-2009 13:01
does collision sound respond in attachments? I forget..
_____________________
|
| . "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...
| -
Ava Velde
Registered User
Join date: 17 Jan 2009
Posts: 310
06-26-2009 11:38
From: Hewee Zetkin
Well, you'll probably want to filter on the type of the thing you collide with. Something like (in an attachment):

CODE

string SOUND = "mySound";
float VOLUME = 0.5;

default
{
collision_start(integer nDetected)
{
integer i;
for (i = 0; i < nDetected; ++i)
{
if (llDetectedType(i) & AGENT)
{
llPlaySound(SOUND, VOLUME);
// Or perhaps llTriggerSound(SOUND, VOLUME);

// Play sound just once for entire collision
return;
}
}
}
}


EDIT: Otherwise you could just use llCollisionSound(). See http://www.lslwiki.net/lslwiki/wakka.php?wakka=llCollisionSound


Trigger sound works with collision - thank u!