Immersive 3D Environments

a central point for students enrolled in A&M624

Particle Systems 101

Particle Laboratory Transport

The Particle Laboratory Transport

For the technical sessions this week you will be working some more at designing interactions and, along side that, investigating Particle Systems which are  basically the special effects side of Second Life.  Particles are used to create everything from flames to waterfalls, fireflies to tornadoes.

You will be travelling to the Particle Laboratory in smalls groups to gain some understanding of what particles are, the scripts used to put them together, the different forms particles can take, and also to collect sample scripts for your own use.

As the smaller groups move to visit the Lab I will remain with the others, where I will work with each of you as required to take you through creating your own interaction.  What you will be required to do is come up with the design of an interaction between an object and an avatar that initiates at least two events and uses at least two functions.

I do not expect you to know the actual syntax of the events or functions you require but instead to describe in plain English, as comments to this blog, what you would like to happen.  I will then guide you to the correct events and functions to use and show you how to put them together as a script so that the interaction works as you would like it to.  You will then be required to post, as a follow up reply to your original comment, the actual script used and a brief summary of how it works and whether it met your purpose.

An example of a possible interaction would be that the object scans a designated area and when it detects an avatar it sends the avatar a message and changes its own colour.  Make sure in your design brief that you state everything required; in this case you would want to state what you are scanning for (i.e. avatar, object etc), the distance and arc to scan and how often the scan repeats itself, what will happen if no avatar is sensed in the scan area, what the message is, whether its in main chat or IM, and what colour to change the object to.

Particle Laboratory Tutorials - Click to Enlarge

Advertisements

August 31, 2010 - Posted by | Building and Texturing, Scripting

11 Comments »

  1. flying it may be out of my capacity at the moment but id like to further my chopper still. perhaps develop a button that turns the rotors on/off or adjusts thier speed and maybe learn to make an object ‘sitable’ so i can add a seat.

    Comment by gryfnn | August 31, 2010 | Reply

  2. OK Gryf so lets do this… think through everything you would need to do to have the button work with the avatar AND with the rotors and write it out for me

    Comment by Isa Goodman | August 31, 2010 | Reply

  3. rotor on off button

    create touch event for the button
    link button to object?
    start rotation of object from touch event
    create touch event for button to turn rotation off or a timer to run rotation out?

    Comment by gryfnn | August 31, 2010 | Reply

    • Gryfnnn can you please remember to post the scripts that we worked through for this, along with comments, up on this blog so that the learning can be shared amongst the group.

      Cheers Isa

      Comment by aarongriffiths | September 3, 2010 | Reply

  4. I would like to create a pole similar to the flame pole example shown in class. However this pole would have the option of displaying the flames in red or blue.

    The natural state of the pole would be set to feature red flames.

    It would scan the area for avatars.

    It would scan approximately every 5 seconds.

    If an avatar is detected within a 10 mtr distance or 10 mtr arc 2 things would happen.

    1st) Instantly the flames would jump and get larger, like a mini explosion. They would stay large for a period of say 5 seconds. Then it would revert to it’s natural size.

    2nd) A message would appear on the detected avatars screen (IM) – I’m not sure exactly what the message would say….something along the lines of…. Fire and Ice, which do you choose? There would be a selection between fire and ice, or they could close and ignore the message.

    If they choose ice, the red flame would instantly glow blue.

    If no avatar is sensed, nothing would happen, it would keep scanning until a detection occurs.

    Comment by katalinakhalifa | September 2, 2010 | Reply

    • Katalina this sounds like a good challenge. So lets have a look at some of the scripts you will need to investigate.

      1. For the flames a particle script is required. Have a look at the particle laboratory for one that would suit your needs and come back to me with what you have chosen.
      2. A script to scan for avatars. A repeating scanner (sensor) is initiated using the llSensorRepeat function and will need to be set up in the state_entry event. Think about the scan rate; 5 secs may be too often given that each scan uses resources which all add up to combine in sim lag. If it is necessary go for it but do take this into consideration. A scan requires two other events; the sensor event and the no_sensor event.
      3. If an avatar is detected you will then need to change the particle script using the sensor event to do so, so that the particles are larger or change their pattern and the colour of the particles change.
      4. The sensor event will also need to send a message to the avatar. Given you want the avatar to choose an option this will need to be done using the llDialog function. So that you target the appropriate avatar you should also understand the llDetectedKey function.
      5. Now when the avatar makes their choice, that choice is sent back to the object that supplied the dialog box, but the object has to listen for that choice. So two more things required here; the llListen function which describes what is being listened for and can be set up in the sensor event, and the listen event which processes the message. Inside this event you will again need to change the particle script to reflect the avatar’s choice.

      Just a few things there to get on with and to start thinking about in terms of the parameters for each function. A great exercise for you in going through all the requirements of an interaction.

      Isa

      Comment by aarongriffiths | September 3, 2010 | Reply

    • One more function and event that I neglected to put in there Katalina. Because you want the larger flame to be a timed event you will need to use the llSetTimerEvent function, initiated in the sensor event, and the timer event to perform the flame reduction again.

      Isa

      Comment by aarongriffiths | September 4, 2010 | Reply

  5. Copied and pasted from Estrella’s blog:

    “I would like to create a globe kind of shape which is constantly flying around in space. Which space I mean in a special location but flying. I then would like this globe to be able to scan avatars within a radius of (don’t know whats appropriate) cm or meters ? and if an avatar is touching the scan video images appear on the globe. Like either a video running within the globe or still images running as a slideshow underlined with text. It would be cool if sound could be incorporated.

    The globe itself is rotating and flying and propably should have some kind of code saying “fly only in unoccupied places”. So there wouldn’t be any collissions.

    I am not sure if it would be easier to screen the video/slideshow within the globe when it is scanned or if when scanned a videoscreen comes up and runs the video . I guess I also need to determine how long I want the video to run before it stops and also if I want the globe to rotate on the spot for that period of time. I get the feeling the code gets quite complicated but I guess you are helping with this?”

    Comment by aarongriffiths | September 6, 2010 | Reply

    • Estrella

      The easiest way to create a flying globe would be to have the globe attached to a pole and a smaller sphere at the other end as a linked group, basically creating something similar to a lolly-pop (but with the small prim as the root prim at the end opposite the lolly). Both the stick and the small prim can be transparent leaving the globe as showing. The small prim can then contain the llTargetOmega function in the state_entry event to make the whole linked group rotate around the small prim giving the impression of the globe flying in space. To get the globe rotating as well you can use the same script in the globe and that will rotate it around its local axis.

      The scan (sensor) facility and the function and events for creating a timer have been mentioned in other comments to this post so you can look those up here. If needed the llTargetOmega function can be used to stop the globe rotating at the moment an avatar is detected. Re the video/slideshow, the better option would be a slideshow as a video is dependent on the user having video media enabled. As this is not a given, a slideshow would be a more certain option for the interaction being seen by detected avatars. This will be triggered by the sensor event and can be scripted for any number of images that are stored in the Content area of the globe prim. The function used to change the texture is llSetTexture and this function can be set up with its own timer event so that it changes after a given amount of time.

      So even though it sounds complicated it isn’t as bad as you might think *smiles.

      Isa

      Comment by aarongriffiths | September 6, 2010 | Reply

  6. The following is the solution to making the rotors turn on and off from a button.

    The first thing that needs to happen in this script is the linking of the button to the rotors. This is acheived using llMessageLinked in the originating object. llMessageLinked can be used to link to all the prims within an object using LINK_ALL_OTHERS or a specific prim can be targeted if you are using multiple links within an object. Specific prims are numbered and you can use the script llGetLinkNumber in a prim to find that prims indervidual identifying number. The prims that you want to acknowledge and respond to the message sent need the script link_message within them.

    To turn the rotors on and off from the same button the if(!rotorOn) and TRUE/FALSE functions are needed. This means if the rotorOn = TRUE the line
    llMessageLinked(LINK_ALL_OTHERS,0,”start”,””);
    is sent to the recieving prim and if rotorOn = FALSE the line
    llMessageLinked(LINK_ALL_OTHERS,0,”stop”,””);
    is sent instead. the scripts in the recieving prims then specify what is to happen when sent “start” or “stop” with the following lines.
    if(str == “start”)
    {llTargetOmega(,2.0,1);} (turn the rotors on)
    else if(str == “stop”)
    { llTargetOmega(,0.0,1);} (turns the rotors off)

    BUTTON SCRIPT
    integer rotorOn = FALSE;
    default

    {
    state_entry()
    {
    }
    touch_start(integer total_number)
    {
    if(!rotorOn)
    {
    llMessageLinked(LINK_ALL_OTHERS,0,”start”,””);
    rotorOn = TRUE;
    }
    else
    {
    llMessageLinked(LINK_ALL_OTHERS,0,”stop”,””);
    rotorOn = FALSE;
    }
    }
    }

    ROTOR SCRIPT
    float speed = 0.0;
    default

    {
    state_entry()
    {
    }

    link_message( integer sender_num, integer num, string str, key id)
    {
    if(str == “start”)
    {
    llTargetOmega(,2.0,1);
    }
    else if(str == “stop”)
    {
    llTargetOmega(,0.0,1);
    }
    }
    }

    Comment by gryfnn | September 6, 2010 | Reply

    • Thanks for posting this Gryfnn. Do a little check though of the parameters for llTargetOmega and make sure they are all there.

      Cheers
      Isa

      Comment by aarongriffiths | September 7, 2010 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: