Jump to content

A bumper that only responds to horizontal collisions?


Leo1452
 Share

You are about to reply to a thread that has been inactive for 1310 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

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 by Leo1452
Link to comment
Share on other sites

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 by Profaitchikenz Haiku
llGetPos(0) was wr--- wr--- not quite right
  • Like 2
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1310 days.

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
 Share

×
×
  • Create New...