llRezObject
void llRezObject(string InventoryItem, vector Position, vector Velocity, rotation Rotation, integer StartParameter)Instantiate owners InventoryItem at Position with Velocity, Rotation and with start StartParameter.
Creates object's inventory item at Position with Velocity and Rotation supplied. The StartParameter value will be available to the newly created object in the on_rez event or through the llGetStartParameter function.
The Velocity parameter is ignored if the rezzed object is not physical.
Parameters
-
InventoryItem(string) -
Position(vector) -
Velocity(vector) -
Rotation(rotation) -
StartParameter(integer)
Basic Rez on Touch
Section titled “Basic Rez on Touch”default{ touch_start(integer param) { llRezObject("Object", llGetPos() + <0.0,0.0,1.0>, <0.0,0.0,0.0>, <0.0,0.0,0.0,1.0>, 0); }}Relative Position, Rotation, and Velocity
Section titled “Relative Position, Rotation, and Velocity”This example demonstrates rezzing an object with position, rotation, and velocity all described relative to the rezzing prim’s coordinate system:
string object = "Object"; // Name of object in inventoryvector relativePosOffset = <2.0, 0.0, 1.0>; // "Forward" and a little "above" this primvector relativeVel = <1.0, 0.0, 0.0>; // Traveling in this prim's "forward" direction at 1m/srotation relativeRot = <0.707107, 0.0, 0.0, 0.707107>; // Rotated 90 degrees on the x-axis compared to this priminteger startParam = 10;
default{ touch_start(integer a) { vector myPos = llGetPos(); rotation myRot = llGetRot();
vector rezPos = myPos + relativePosOffset * myRot; vector rezVel = relativeVel * myRot; rotation rezRot = relativeRot * myRot;
llRezObject(object, rezPos, rezVel, rezRot, startParam); }}Caveats
Section titled “Caveats”- The root prim of the rezzed object is not positioned at
pos—instead, the geometric center is positioned there. UsellRezAtRootif you need the root prim at the exact position. - Silently fails to rez if
posis too far from the geometric center of the rezzing object. If rezzing mysteriously fails, ensure you’re using a formula likellGetPos() + <0.0,0.0,1.0>for the position rather than a hardcoded vector like<0.0,0.0,1.0>. - When rezzing from attachments,
llGetPos()returns the position of the avatar’s bounding box geometric center, not the attachment’s position. See the caveats forllParticleSystemfor more information. - If the object is unattached and the owner lacks copy permission on the inventory item, the object is consumed from inventory when rezzed (subsequent rez attempts fail). If the owner has copy permission, a copy is rezzed and the original remains.
- If the object is attached and the owner lacks copy permission, an error is shouted on DEBUG_CHANNEL: “Cannot rez no copy objects from an attached object.”
- Silently fails if you lack offline building rights. Required permissions include:
- Own the land, OR
- Land allows anyone to build (e.g., sandbox), OR
- Object is deeded to the land group, OR
- Object is set to the land group and the parcel has “allow group to build” enabled
- Group role “Always allow ‘Create Objects’” only works when you’re online in the region.
Maximum Rez Distance
Section titled “Maximum Rez Distance”The maximum distance you can rez from is determined by object size. These measurements were taken on server version 1.38:
- Distance is measured between the centers of the rezzing prim and the rezzed prim
- A 10.0 meter cube can rez a 0.5 meter cube approximately 18.6 meters away
- A 0.01 meter cube can rez a 0.5 meter cube approximately 10.0 meters away
- The
paramvalue becomes the start parameter for the rezzed object’son_rezevent and is retrievable viallGetStartParameter - For object-to-object communication, see
object_rezevent examples - Velocity is ignored if the rezzed object is not physical
See Also
Section titled “See Also”- llRezAtRoot
- llGetStartParameter
- llGodLikeRezObject
object_rez- Event triggered when this object rezzes another objectPRIM_TEMP_ON_REZ- Prim property for temporary rezzing