Tuesday, 5 October 2010

Week 3: Make a simple object (Gun) which can fire bullets to the wall

In the third week, I tried to look up on the wiki lsl scripts which helped me buidling on some interesting and playable objects.

Here is what I've tried doing in the on going weeks for the prototype before starting the assignment:


Heres the script screen shot:

 default
{
    state_entry()
    {
        llSetText("Fire!",<0,1,0>,2);
    }


    touch_start(integer total_number)
    {
        // Gets parent object position, rotation and front, establishes projectile speed
        vector position = llGetPos();
        float speed = 25;
        rotation rot = llGetRot();
        vector front = llRot2Fwd(rot);
      
        //Sets trajectory based on front
        vector velocity = speed*front;
      
        llOwnerSay("Fire.");
      
        //Fire "projectile" from the parent object
        llRezObject("bullet", position, velocity, rot, 4);
    }
}

No comments:

Post a Comment