Leo1452 Posted October 1, 2020 Posted October 1, 2020 (edited) Here's an example of an avatar bumper sound script. Is there a way for it to only detect horizontal collisions such that if you tp on someone's head, it doesn't play. This is for people with tp sounds because one sound will interrupt the other. float volume = 1.0; //Volume 0.0 - 1.0; default { collision_start(integer num) { if(llDetectedType(0) & AGENT) { llStartAnimation("lulz"); llPlaySound(llGetInventoryName(INVENTORY_SOUND,llFloor(llFrand(llGetInventoryNumber(INVENTORY_SOUND)))),1.0); llSetTimerEvent(1.0); } } timer() { llStopAnimation("lulz"); } attach(key uid) { if(llGetAttached()) llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION); } } Edited October 1, 2020 by Leo1452
Profaitchikenz Haiku Posted October 1, 2020 Posted October 1, 2020 (edited) I'm not sure if this is for a car bumper (I think they call them fenders over the other side of the pond) but the obvious way is to get the position of the colliding object via llDetectedPos(0), and compare the z component with that of llGetPos(), the absolute value of the difference in heights is then used with a tolerance to determine if the two are level or not. Edited October 1, 2020 by Profaitchikenz Haiku llGetPos(0) was wr--- wr--- not quite right 2
Bugs Larnia Posted October 5, 2020 Posted October 5, 2020 The only thing I can really think of is using llDetectedVel(0) in the collision event to get the colliding agent's velocity (vector) and then checking whether the X and/or Y are unequal to zero or higher than some arbitrary minimum value you set after lots of experimentation.
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now