Jump to content

A bumper that only responds to horizontal collisions?


You are about to reply to a thread that has been inactive for 221 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 post
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 post
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 post
Share on other sites
You are about to reply to a thread that has been inactive for 221 days.

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...