Join us in Outworldz at http://www.outworldz.com:9000 or follow us:

[Table of Contents]

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Description: Creator:
Building This set of scripts will draw a bezier curve segment controlled by 3 control points. // // It tries to be the foundation of a more general graph server in SL. // // The idea and first version of the bezier curve demo script, was given to me by CatherineOmega. She had a working script that rezzed small spheres in each point position. // Then i added some modifications and the possibility of drawing segments made up of cylinders to rezz a line instead of just points. // // The complete bezier server consists of several parts: // // * Server:An object that controls and creates the graph. We call this // * Control Points p1,p2,p3: control points that controls the begining, direction and end of the bezier segments. // * Point Mark: the object (may be a sphere or other) contained in the server that is rezzed in each created point mark position. // * Segment: the object (a cylinder) contained in the server that is rezzed when a line segments are required instead of point marks. // // // A description of each part will be given. // // // Server object // // Description // // The server object is the one which calculates the point coordinates interpolated using a bezier curve. // It rezzes the segments or point marks. // It shows the positions of the three control points in its display text. // Commands to it are given in the channel 1. // It receives the positions in that channel from the control points, and when it has all three, draws the curve. // When a new position is received from a control point, it clears the previously rezzed objects and draws new ones. // The server knows which control point has moved by the name of the object that has said the command it receives. // // Commands - How to use // // Once you have rezzed the bezier server, you can say commands to it through channel #1 to control its behaviour. // Commands are: // // * "/1 markers on": activate the drawing of markers. This is the default option. // * "/1 markers off": deactivate them. // * "/1 lines on": activate the drawing of a line made of segments. // * "/1 lines off": deactivate the drawing of segments. This is the default option. // * "/1 segments n": set the number of segments that should be drawn to n. // * "/1 start": this command forces the drawing of the curve. // * "/1 mu float": draws a point corresponding to the given value of mu parameter. // // // How to create de server // // To create the bezier demo server object, create a prim that you like and put the following script in its inventory. // Then you should create the segment and point mark objects (see descriptions below) and put them in the inventory of the server object too (see bellow).
Building // Control Points // Description // // The Control Point objects are the prims that you can position in place to control the shape of the bezier curve. // A Bezier curve has three control points (p1,p2, and p3). // The curve passes through p1 and p3 and p2 controls the curvature and tangent direction of the curve in p1 and p3. // When a control point is moved or you touch it, it says its position through channel #1 to the bezier server. // // To use them, just rezz one object of each type (p1,p2 and p3) and move it to the position you want. The curve should be drawn if you have rezzed the bezier server first. // // Commands - How to use // The control points don't obey any command. They just have a simple script to say their position to the bezier server trough channel #1 // // How to Create the Control Points // // Create three prims (may be a simple sphere prim) with different colors and name them p1, p2 and p3 (be sure to name it that way: the server uses the name to differentiate which point has been moved or touched). // // Then put the following script in each control point.
Building oint Mark // Description // // The Point Marks are the prims drawn in each interpolated point of the bezier curve when markers mode is active. // You can use any prim, as a small sphere for example. // The Point Mark object should be in the inventory of the bezier server object, as it is rezzed from the script of that object. // The Point Marks are very simple, as they don't need to communicate with other scripts. // For convenience, they just listen in channel # 1 for clear commands, to delete themselves. // // Commands - How to use // // The point marks listen in channel #1 for clear commands to delete themselves. // say "/1 clear": deletes all point marks. // // How to Create the Point Mark object // // Create the prim or object you want to be rezzed in each point position. Name it Point Mark. Then put the following script in it. // Take the object to your inventory and copy it from there to the inventory of the bezier server object.
Building // Segment // Description // // The Segments are the prims drawn to make the lines of the bezier curve when you set lines mode on. // The prim should be a cylindre. // // The Segment object should be in the inventory of the bezier server object, as it is rezzed from the script of that object. // The bezier server object rezzed the cylindre, rotates it to orient it properly in the direction of the line and then gives it a command to initialize its size correctly (as the size of an object cannot be stablished when rezzed and the parameters of a prim can only be altered by itshelf). // // Commands - How to use // // Each segment object listens in the channel corresponding to its line number for clear commands to delete themselves. // say "/line# clear": deletes all point marks. // The segment object listen for seginit commands from the bezier server object in its line# channel addressed to its segment number. // The channel number and segment number are coded in an integer that is passed to the segment when rezzed. // In this example the line # is always 1. // The command is: // "/line# segment#,diam,size" where segment# is the number of the segment to be initilized, diam is the diameter fo the cylindre and size is its lenght. // How to Create the Segment Object // // Create a cylindre of any size, set a blank texture and choose its color. Save it with name Segment. // Put the following script in it. // Then, take the object to your inventory and copy it from there to the inventory of the bezier server object.

Back to the Best Free Tools in Second Life and OpenSim.