Wednesday, 13 October 2010

Week 4: Making a wall such that when the ball collides, shows the speed of the ball travelling and the detected object.

I've tried to script the wall such that, when the upon firing the rezz launcher it collides with the wall in front (Red wall) with the following screen shot as you can see:



Here is the screen shot of the script with desired effect:
default
{
    state_entry()
    {
    }

    collision_start(integer num_detected)
    {
        // Finds the name of the object that collides
        llOwnerSay("Collided with " + llDetectedName(0));
       
        //Finds the velocity in a vector and converts to its magnitude
        vector velocity = llDetectedVel(0);
        float normVelocity = llVecMag(velocity);
        string objectOwner = llKey2Name((string)llDetectedOwner(0));
           
        llOwnerSay(objectOwner + " travelling at " + (string)normVelocity + " m/s");
       
    }
}

No comments:

Post a Comment