Difference between revisions of "LlRezObject"

From Second Life Wiki
Jump to: navigation, search
m
 
(3 intermediate revisions by 2 users not shown)
Line 19: Line 19:
 
**The documented limit is 10 meters; however in at least some server versions experimentation reveals a larger limit that seems to be related to the size of the object doing the rezzing: See [[llRezObject#Notes | Notes]] for more info.
 
**The documented limit is 10 meters; however in at least some server versions experimentation reveals a larger limit that seems to be related to the size of the object doing the rezzing: See [[llRezObject#Notes | Notes]] for more info.
 
* When scripting attachments meant to rez objects, remember that attachments move. You will need to use <code>[[llGetPos]]()</code> and add it to {{LSLP|pos}} to obtain a faithful position for your rezzed object. When used in the root of an ([[attach|attached]]) [[attachment]] <code>[[llGetPos]]</code> doesn't return the position of the attachment but instead returns the position of the avatar's bounding box geometric center. Read [[llGetPos]] and [[llParticleSystem#Caveats | llParticleSystem Caveats]] for more information.
 
* When scripting attachments meant to rez objects, remember that attachments move. You will need to use <code>[[llGetPos]]()</code> and add it to {{LSLP|pos}} to obtain a faithful position for your rezzed object. When used in the root of an ([[attach|attached]]) [[attachment]] <code>[[llGetPos]]</code> doesn't return the position of the attachment but instead returns the position of the avatar's bounding box geometric center. Read [[llGetPos]] and [[llParticleSystem#Caveats | llParticleSystem Caveats]] for more information.
* If the owner of the object does not have copy permission  on {{LSLP|inventory}}, the object will no longer be present in inventory after it is rezzed (so another attempt to rez (the same object) will fail); if the owner does have copy permission, then a copy is rezzed, and the original {{LSLP|inventory}} remains in inventory.
+
* If the object is unattached and the owner of the object does not have copy permission  on {{LSLP|inventory}}, the object will no longer be present in inventory after it is rezzed (so another attempt to rez (the same object) will fail); if the owner does have copy permission, then a copy is rezzed, and the original {{LSLP|inventory}} remains in inventory.
 +
* If the object is attached and the owner of the object does not have copy permission  on {{LSLP|inventory}}, an error is shouted on [[DEBUG_CHANNEL]]: "Cannot rez no copy objects from an attached object."
 
*Silently fails to rez {{LSLP|inventory}} if {{LSLP|position}} is more than 10 meters away from the prim trying to rez {{LSLP|inventory}}.
 
*Silently fails to rez {{LSLP|inventory}} if {{LSLP|position}} is more than 10 meters away from the prim trying to rez {{LSLP|inventory}}.
 
*Silently fails if you don't have offline building rights on the land. To have the right, your objects needs to ''either'':  
 
*Silently fails if you don't have offline building rights on the land. To have the right, your objects needs to ''either'':  
Line 27: Line 28:
 
** Be set to the same group that owns the land and the land have the parcel flag 'allow group to build' set.
 
** Be set to the same group that owns the land and the land have the parcel flag 'allow group to build' set.
 
** The group role "Always allow 'Create Objects'" will only work to override this when you are online, in the region, or have a child agent in the region. See [[#SVC-3145|SVC-3145]] in the Issues subsection of Deep Notes for more information.
 
** The group role "Always allow 'Create Objects'" will only work to override this when you are online, in the region, or have a child agent in the region. See [[#SVC-3145|SVC-3145]] in the Issues subsection of Deep Notes for more information.
 +
* See [[object_rez]] for examples on how to establish communications between the rezzing object and the new prim.
 
|constants
 
|constants
|examples=<lsl>default
+
|examples=<source lang="lsl2">default
 
{
 
{
 
     touch_start(integer param)
 
     touch_start(integer param)
Line 34: Line 36:
 
           llRezObject("Object", llGetPos() + <0.0,0.0,1.0>, <0.0,0.0,0.0>, <0.0,0.0,0.0,1.0>, 0);
 
           llRezObject("Object", llGetPos() + <0.0,0.0,1.0>, <0.0,0.0,0.0>, <0.0,0.0,0.0,1.0>, 0);
 
     }
 
     }
}</lsl>
+
}</source>
<lsl>// Rez an object on touch, with relative position, rotation, and velocity all described in the rezzing prim's coordinate system.
+
<source lang="lsl2">// Rez an object on touch, with relative position, rotation, and velocity all described in the rezzing prim's coordinate system.
 
string object = "Object"; // Name of object in inventory
 
string object = "Object"; // Name of object in inventory
 
vector relativePosOffset = <2.0, 0.0, 1.0>; // "Forward" and a little "above" this prim
 
vector relativePosOffset = <2.0, 0.0, 1.0>; // "Forward" and a little "above" this prim
Line 55: Line 57:
 
         llRezObject(object, rezPos, rezVel, rezRot, startParam);
 
         llRezObject(object, rezPos, rezVel, rezRot, startParam);
 
     }
 
     }
}</lsl>
+
}</source>
 
|helpers
 
|helpers
 
|also_constants=
 
|also_constants=

Latest revision as of 11:03, 4 October 2019

Summary

Function: llRezObject( string inventory, vector pos, vector vel, rotation rot, integer param );

Instantiate inventory object at pos with velocity vel and rotation rot with start parameter param

• string inventory an object in the inventory of the prim this script is in
• vector pos position in region coordinates
• vector vel velocity (max magnitude is approximately 200m/s)
• rotation rot rotation
• integer param on_rez event parameter and value returned by llGetStartParameter in the rezzed object (or by each of the items in a coalesced object).

The root of inventory is not at pos but the center of inventory is.
To have the root prim at pos use llRezAtRoot instead.

Caveats

  • This function causes the script to sleep for 0.1 seconds.
  • If inventory is missing from the prim's inventory or it is not an object then an error is shouted on DEBUG_CHANNEL.
  • Silently fails to rez inventory if pos is too far from the prim trying to rez inventory.
    • If your script is mysteriously failing to rez things, make sure you haven't (say) written "<0.0,0.0,1.0>" for the pos parameter rather than (say) llGetPos() + <0.0,0.0,1.0>".
    • The documented limit is 10 meters; however in at least some server versions experimentation reveals a larger limit that seems to be related to the size of the object doing the rezzing: See Notes for more info.
  • When scripting attachments meant to rez objects, remember that attachments move. You will need to use llGetPos() and add it to pos to obtain a faithful position for your rezzed object. When used in the root of an (attached) attachment llGetPos doesn't return the position of the attachment but instead returns the position of the avatar's bounding box geometric center. Read llGetPos and llParticleSystem Caveats for more information.
  • If the object is unattached and the owner of the object does not have copy permission on inventory, the object will no longer be present in inventory after it is rezzed (so another attempt to rez (the same object) will fail); if the owner does have copy permission, then a copy is rezzed, and the original inventory remains in inventory.
  • If the object is attached and the owner of the object does not have copy permission on inventory, an error is shouted on DEBUG_CHANNEL: "Cannot rez no copy objects from an attached object."
  • Silently fails to rez inventory if position is more than 10 meters away from the prim trying to rez inventory.
  • Silently fails if you don't have offline building rights on the land. To have the right, your objects needs to either:
    • Be on land you own yourself.
    • Be on land where anyone is allowed to build, e.g. a sandbox.
    • Be deeded to the group that owns the land.
    • Be set to the same group that owns the land and the land have the parcel flag 'allow group to build' set.
    • The group role "Always allow 'Create Objects'" will only work to override this when you are online, in the region, or have a child agent in the region. See SVC-3145 in the Issues subsection of Deep Notes for more information.
  • See object_rez for examples on how to establish communications between the rezzing object and the new prim.

Important Issues

~ All Issues ~ Search JIRA for related Bugs
   group ROLE permissions only work for scripted rez when owner is online
   llRezObject at wrong position when rezzing a linkset that was previously rotated in-world.

Examples

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);
     }
}
// Rez an object on touch, with relative position, rotation, and velocity all described in the rezzing prim's coordinate system.
string object = "Object"; // Name of object in inventory
vector relativePosOffset = <2.0, 0.0, 1.0>; // "Forward" and a little "above" this prim
vector relativeVel = <1.0, 0.0, 0.0>; // Traveling in this prim's "forward" direction at 1m/s
rotation relativeRot = <0.707107, 0.0, 0.0, 0.707107>; // Rotated 90 degrees on the x-axis compared to this prim
integer 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);
    }
}

Notes

Maximum rez distance

  • After tests on server 1.38, these figures were measured - (on some earlier server versions the same further-than-10-meter rezzes have been possible).
  • The distance measured is between the center of the rezzing prim and the center of the prim that is rezzed.
    • The tests did not include rezzing from or the rezzing of link_set objects.
    • A 10.0 meter cube could rez a 0.5 meter cube just beyond 18.6 meters away.
    • A 0.01 cube could rez a 0.5 meter cube just beyond 10.0 meters away.
  • There was seen to be a sliding scale between these figures. The max distance growing with the size of the rezzer.
  • Even if the attempted rez succeeds, the rezzed object may not be exactly at the pos ordered by the script. It seems that the accuracy of the final pos reduces the closer your ordered pos is to the maximum that would succeed. Such quirks as, whether the rezzing prim was snapped-to-grid or not even seemed to have an effect. As with everything in SL, experimentation is key.
  • Setting a script up to rez objects outside the previously established known maximum of 10.0 meters is something that you need to be aware may stop working at any time in the future. Without solid verification from Linden Labs, 10.0 meters should be considered a safe maximum distance.

See Also

Constants

•  PRIM_TEMP_ON_REZ

Events

•  object_rez triggered when this object rezzes an object from inventory

Functions

•  llRezAtRoot Rezzes the object at the requested position
•  llGetStartParameter
•  llGodLikeRezObject

Deep Notes

All Issues

~ Search JIRA for related Issues
   group ROLE permissions only work for scripted rez when owner is online
   llRezObject at wrong position when rezzing a linkset that was previously rotated in-world.
   parcel build permissions needs whitelist
   llRezTempObject() - for temporarily rezzing objects

Signature

function void llRezObject( string inventory, vector pos, vector vel, rotation rot, integer param );