Quote:
Originally Posted by Fred Rookstown HINT: collision_start and collision_end |
I've found these difficult to use with collision event detection on a floor. Since walking or standing on one behaves almost like a single, constant collision, I often see them triggered only as you hit the floor (collision_start) or leave it (collision_end).
@Vengeance
I've recently done some scripting for collision detection, avatar position and velocity/speed. Here is a snippet of that handiwork. If the sound file you use is a short clip, it should do:
Code:
string mySound = "step.wav"; // sound in prim inventory
vector agentVel; // 'avatar' velocity
default
{
collision(integer total_number)
{
agentVel = llDetectedVel(0); // detect the avatar's velocity
if( (llFabs(agentVel.x) > 1.5) || (llFabs(agentVel.y) > 1.5) )
{
llPlaySound(mySound, 0.5);
llSleep(0.4);
}
}
}
What this does is detect the velocity/speed of an avatar (agent) during a collision event, and if it is equal to or less than 1.5 meters per second in the x or y directions, it plays the sound. 1.5mps is good cut off point I think. Walking velocity is north of 3 in any cardinal direction, and we need to make sure not to trigger the sound when turning (or fidgeting

).
The sleep is in there to cause a break in the multiple collisions occurring. I suggest playing with the duration in the llSleep() function until it fits the sound file's length best. Of course, set mySound to the name of the "walk" sound file that is in the object.