Change font size
It is currently Wed Aug 15, 2018 1:17 pm

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 1   [ 1 post ]
Author Message
 Post subject: Random prim movement within boundaries
PostPosted: Sat Apr 09, 2011 4:23 am 
OSG Elite

Joined: Wed Aug 05, 2009 1:59 am
Posts: 417
Something I found on internet:

Random prim movement within boundaries.
----------------------------------------

This script moves objects within a pre-defined area. (Like those floating islands in the movie 'Avatar')
Here is where I found it: http://www.free-lsl-scripts.com/freescripts.plx?ID=1468
I've tested it, and it works!

And the script:
{L_CODE}:
// Script Name: Moving_Mountains_-_like_in_Avatar.lsl
// Author: Ferd Frederix
//I wanted to make mountains , like in the movie Avatar, that periodically move around in the sky.   This script will move them inside a defined area every 10 minutes.   You can easily change the numbers to move them as much, or as little as you want, and keep them inside a defined boundary.   

// Downloaded from : http://www.free-lsl-scripts.com/freescripts.plx?ID=1468

// This program is free software; you can redistribute it and/or modify it.
// License information must be included in any script you give out or use.
// This script is licensed under the Creative Commons Attribution-Share Alike 3.0 License
// from http://creativecommons.org/licenses/by-sa/3.0 unless licenses are
// included in the script or comments by the original author,in which case
// the authors license must be followed.

// Please leave any authors credits intact in any script you use or publish.
////////////////////////////////////////////////////////////////////
float maxX = 150;    // 255 max
float minXY = 10;    // get no closer than 10 meters to any edge
float maxY= 180;     // 255 max
float minH = 35;      // go no lower than this
float maxH = 100;    // go no higher than this

default
{
    state_entry()
    {
        llSetTimerEvent(600.0);   // every 10 minutes, move mountains
    }

    timer()
    {
        vector C;

        C= llGetPos();
       
        if (C.y > maxY) // N
            C.y -= 20;
       
        if (C.x > maxX)  // E
            C.x -= 20;

        if (C.x < minXY)   // W
            C.x += 20;   
       
        if (C.y  < minXY)    // S
            C.y += 20;
       
        if (C.z > maxH)   // U
            C.z -= 20;   
       
        if (C.z < minH)    // D
            C.z += 20;
           
           
        float sign = llFrand(2.0);   
        if (sign > 1.0)
            C.x += llFrand(10);
        else
            C.x -= llFrand(10);
       
        sign = llFrand(2.0);   
        if (sign > 1.0)
            C.y += llFrand(10);
        else
            C.y -= llFrand(10);
           
        sign = llFrand(2.0);   
        if (sign > 1.0)
            C.z += llFrand(10);
        else
            C.z -= llFrand(10);

       
        llSetPos(C);

    }
}




Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 1 post ]


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net