Because both Second Life and OpenSim grids have prim limits, one of the things I taught myself to construct very early on in my inworld builds were rezzers; at their most basic a method of rezzing objects inworld from another object’s Content area (or in scripting terms the object’s inventory). They served various functions; in some cases to cause objects to rez only when people were in a certain area, at other times to give people options of different scenes, as in this fully functioning holodeck from the SLENZ Foundation Studies build (see the following YouTube video).
In most cases the rezzers were designed to lower the number of prims on a sim or parcel when the objects or scenes were not in use and at the same time give users more choices in an area than were permitted within the prim limits, albiet not all at once.
Holodeck scripts can be quite complex but their base rezzing functions are actually relatively simple. Throughout this and one or two subsequent posts I will guide you through some of the script variations that will allow you to construct your own rezzer and add different levels of complexity to build it up to a fully functioning holodeck.
In terms of rezzing an object from the Content area of another there are two choices as far as functions go; llRezObject and llRezAtRoot. To demonstrate the difference I have constructed a 4 prim, linked object called rezTest, with an orange prim set as the root prim. The centre of the object is a point between the orange and blue prims (as shown). This object is taken into Inventory.
Note: The object to be rezzed must have copy permissions to enable multiple rezzings. If the land the rezzer is on restricts building to the land group the rezzer must be set to group.
The two rezzing functions in LSL have the same parameters, as follows:
llRezObject(string inventory, vector position, vector velocity, rotation rot, integer param);
llRezAtRoot(string inventory, vector position, vector velocity, rotation rot, integer param);
The first, inventory, is the name of the stored object in the rezzing object’s inventory (or Content area). Next is position, the position in region coordinates where the object will be rezzed. Then velocity, the speed that the rezzed object is moving at when rezzed, rot, the rezzed object’s rotation and param, a value that can be returned in the rezzed object using the function llGetStartParameter.
Note: The position value has a limit of 10 metres from the rezzing object’s coordinates.
As mentioned the object rezTest must be stored in the rezzing object’s inventory. This is achieved by opening the Content tab of the rezzing object, opening Inventory, then clicking and dragging rezTest from there onto the Content area and releasing the mouse button. The object rezTest will display in the Content area as shown.
The first demonstrated script uses llRezObject as the rezzing function and touch_start to activate it, so that touching the box will rez the rezTest object. It uses llGetPos(), the position of the box, as the position that rezTest will be rezzed at and has zero velocity, zero rotation and the value 0 as the start parameter.
llRezObject(“rezTest“, llGetPos(), <0.0, 0.0, 0.0>, <0.0, 0.0, 0.0, 1.0>, 0);
The second script uses exactly the same parameter values except that the llRezAtRoot function is used instead.
llRezAtRoot(“rezTest“, llGetPos(), <0.0, 0.0, 0.0>, <0.0, 0.0, 0.0, 1.0>, 0);
The resulting rez positions are as shown below. Whereas llRezObject places the centre of the object at the position coordinates (i.e. at llGetPos(), the coordinates of the rezzer), with llRezAtRoot the centre of the root prim is placed at the position coordinates.
For myself the preferred function to use is llRezAtRoot as the coordinates of the root prim correspond to the coordinates of the actual object as shown in the Build window. This facilitates finding the required position parameters for objects that will later on be rezzed as a scene. llRezObject is more likely to be used in a shop system that rezzes samples of objects from a vendor for viewing before purchasing. In this case one would probably want the centre of the sample to be at the same position each time an object is displayed.
In the next post for this series I’ll start to add a little more complexity to this simple rezzing script. Till then enjoy!
Next in this Series: Rez Object Rotations