Difference between revisions of "LlRezObject"

From Second Life Wiki
Jump to: navigation, search
m
Line 8: Line 8:
 
|p4_type=rotation|p4_name=rot|p4_desc=rotation
 
|p4_type=rotation|p4_name=rot|p4_desc=rotation
 
|p5_type=integer|p5_name=param|p5_desc=[[on_rez]] event parameter and value returned by [[llGetStartParameter]] in the rezzed object (or by each of the items in a coalesced object).|p5_hover=on_rez event parameter and value returned by llGetStartParameter in the rezzed object.
 
|p5_type=integer|p5_name=param|p5_desc=[[on_rez]] event parameter and value returned by [[llGetStartParameter]] in the rezzed object (or by each of the items in a coalesced object).|p5_hover=on_rez event parameter and value returned by llGetStartParameter in the rezzed object.
|func_footnote=The root of '''inventory''' is not at '''pos''' but the center of '''inventory''' is.<br/>To have the root prim at '''pos''' use [[llRezAtRoot]] instead.
+
|func_footnote=The root of '''inventory''' is not at '''pos''' but the [[llGetGeometricCenter|center]] of '''inventory''' is.<br/>To have the root prim at '''pos''' use [[llRezAtRoot]] instead.
 
|func_desc=Instantiate '''inventory''' object at '''pos''' with velocity '''vel''' and rotation '''rot''' with start parameter '''param'''
 
|func_desc=Instantiate '''inventory''' object at '''pos''' with velocity '''vel''' and rotation '''rot''' with start parameter '''param'''
 
|return_text
 
|return_text

Revision as of 12:01, 21 January 2010

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 250)
• 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.
  • In addition to the normal function delay, there is an additional delay based on the mass and velocity of the object rezzed.
    • rez_delay = mass * llVecMag(velocity) / 10; [1]
  • Silently fails to rez inventory if pos is more than 10 meters away from the prim trying to rez inventory. So if your script is mysteriously failing to rez things, make sure you haven't (say) written "<0,0,1>" for the pos parameter rather than (say) "llGetPos() + <0,0,1>".
  • 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 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 it is likely to fail); if the owner does have copy permission, then a copy is rezzed, and the original inventory remains in inventory.
  • Silently fails if you don't have offline building rights on the land.
    • Which means that you need to either:
      1. Own the land yourself.
      2. Be in the group that owns it, the allow group to build parcel flag has to be enabled and the object has to be set to group.
      3. Or everyone should be allowed to build.
      4. You can also deed the object to the group that owns the land, this will always work.
    • The group role "Always allow 'Create Objects'" will only work to override this when you are online. See SVC-3145 in the Issues subsection of Deep Notes for more information.

Important Issues

~ All Issues ~ Search JIRA for related Bugs
   group ROLE permissions only work for scripted rez when owner is online

Examples

<lsl>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);
    }

}</lsl> <lsl>// 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);
   }
}</lsl>

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

Signature

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