Difference between revisions of "LlRezObject"

From Second Life Wiki
Jump to navigation Jump to search
(Add a link to llGetParcelFlags to test if rezzing is permitted)
(44 intermediate revisions by 21 users not shown)
Line 1: Line 1:
{{LSL_Function
|inject-2={{Issues/SVC-3145}}{{Issues/SVC-6578}}{{Issues/SVC-6686}}{{Issues/SCR-485}}
{{LSL_Function/inventory|inventory|uuid=false|type=object}}
{{LSL_Function/inventory|inventory|uuid=false|type=object}}
{{LSL_Function
{{LSL_Function/position|pos|region=*}}
|func_id=104|func_sleep=0.1|func_energy=200.0
|func_id=104|func_sleep=0.1|func_energy=200.0
|func=llRezObject|sort=RezObject
|func=llRezObject|sort=RezObject
|p1_type=string|p1_name=inventory
|p1_type=string|p1_name=inventory
|p2_type=vector|p2_name=pos|p2_desc=position (in [[Viewer coordinate frames#Region|region coordinates]])|p2_hover=position (in region coordinates)
|p2_type=vector|p2_name=pos
|p3_type=vector|p3_name=vel|p3_desc=velocity (max [[llVecMag|magnitude]] is 250)
|p3_type=vector|p3_name=vel|p3_desc=velocity (max [[llVecMag|magnitude]] is approximately 200m/s)
|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.|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 {{LSLP|inventory}} is not at {{LSLP|pos}} but the [[llGetGeometricCenter|center]] of {{LSLP|inventory}} is.<br/>To have the root prim at {{LSLP|pos}} use [[llRezAtRoot]] instead.
|func_desc=Instantiate '''inventory''' object at '''pos''' with velocity '''vel''' and rotation '''rot''' with start parameter '''param'''
|func_desc=Instantiate {{LSLP|inventory}} object at {{LSLP|pos}} with velocity {{LSLP|vel}} and rotation {{LSLP|rot}} with start parameter {{LSLP|param}}
|return_text
|return_text
|spec
|spec
|caveats=
|caveats=
*In addition to the normal function delay, there is an additional delay based on the mass and velocity of the object rezzed.
*Silently fails to rez {{LSLP|inventory}} (to have it's geometric center at {{LSLP|pos}}) if {{LSLP|pos}} is too far from the geometric center of the object trying to rez {{LSLP|inventory}}.
**<code>rez_delay = mass * llVecMag(velocity) / 10;</code> [http://forums.secondlife.com/showthread.php?t=82659]
**If your script is mysteriously failing to rez things, make sure you haven't (say) written "<code><0.0,0.0,1.0></code>" for the {{LSLP|pos}} parameter rather than (say) <code>[[llGetPos]]() + <0.0,0.0,1.0></code>".
*Rot function have 4 numbers to rotate the rez object like this one <0.0,0.0,0.0,1.0> on the Z axis , Y axis and X axis. It depend where the number is place on the coordinate parenthesis. Negative number is require and no number up to 1. If you have one tin square, the first two digits rez the object up side down your square horizontally.The coordinate <1,1,0,0> rez the object up side down but in the same direction of the primitive that rez the object whit no Z rotation axis. If <1,0,0,0> the object turn 90 degree left. If <1,.5,0,0> the object is rezz 45 degree up side down left side. So you need to do an convertion ( .5 x 90 degrees = 45 degree).  If <0,0,1,1> the object is the correctly whit no rotation.<0,0,1,.5> the object is rez 45 degree rotation  on right side on Z axis.But If you put <-1,0,1,0> the object rotate 180 degrees on his X axis. Where that become complicated is when the number 1 or 1< is on two separate place like this one <0,1,0,1>. In this position the coordinate rez the object on the X axis or if you prefer rotate before you see it on the X axis.  rez the tin square vertically point on left side and rotate It on the X axis. If you put  the tin plate rotate 180 degree on the X axis point on left. Even if the coordinate is <0,1,0,1> butt are going to show another oposite face of the prim.So if coordinate is negative ,the square point to the right direction.Be carful, whit -1 the sqare did not point to right<-1,0,-1,0> Is's point to the left as the sames <1,0,1,0> coordinate.  Now, if the two numbers that not exceede one (1<) are in the two extremity like this . The object will appear on the Y axis point to the negative side of Y asix. To do the opposite action on the Y asix, you put the number 1 like this <0,1,1,0>. So the object are doing to rotate 180 degrees on X asix if you prefer that way to see.
* When scripting attachments meant to rez objects, remember that 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.
*Silently fails to rez '''inventory''' if '''pos''' is more than 10 meters away. 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>".
* 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 owner of the object does not have copy permission  on '''inventory''', the object will no longer be present in inventory after it is rezed (so another attempt to rez it is likely to fail); if the owner does have copy permission, then a copy is rezed, and the original '''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 if you don't have offline building rights on the land. Which means that you need to either: Own the land yourself. Be in the group that owns it, and the allow group to build parcel flag has to be enabled. Or everyone should be allowed to build. You can also deed the object to the group that owns the land, this will always work.|constants
*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.
|examples=<lsl>default
** 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|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
|examples=<source lang="lsl2">default
{
{
     touch_start(integer param)
     touch_start(integer param)
Line 27: Line 34:
           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>
<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
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);
    }
}</source>
|helpers
|helpers
|also_constants=
{{LSL DefineRow||[[PRIM_TEMP_ON_REZ]]|}}
|also_functions=
|also_functions=
{{LSL DefineRow||[[llRezAtRoot]]|Rezzes the object at the requested position}}
{{LSL DefineRow||[[llRezAtRoot]]|Rezzes the object at the requested position}}
{{LSL DefineRow||[[llGetStartParameter]]|}}
{{LSL DefineRow||[[llGetStartParameter]]|}}
{{LSL DefineRow||[[llGodLikeRezObject]]|}}
{{LSL DefineRow||[[llGodLikeRezObject]]|}}
{{LSL DefineRow||[[LlGetParcelFlags#Examples]]|Test if the parcel allows this script to rez}}
|also_tests
|also_tests
|also_events=
|also_events=
{{LSL DefineRow||[[object_rez]]|triggered when this object rezzes an object from inventory}}
{{LSL DefineRow||[[object_rez]]|triggered when this object rezzes an object from inventory}}
|also_articles
|also_articles
|note_rotation=
|notes='''Maximum rez distance'''
|notes
*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 {{LSLP|distance}} measured is between the [[llGetPos|center]] of the rezzing {{LSLP|prim}} and the [[llGetPos|center]] of the {{LSLP|prim}} that is rezzed.
**The tests did not include rezzing from or the rezzing of link_set objects.
**A <code>10.0</code> meter cube could rez a <code>0.5</code> meter cube just beyond <code>18.6</code> meters away.
**A <code>0.01</code> cube could rez a <code>0.5</code> meter cube just beyond <code>10.0</code> meters away.
|permission
|permission
|inventory
|inventory
Line 44: Line 79:
|cat1=Rez
|cat1=Rez
|cat2=Object
|cat2=Object
|cat3
|cat3=Inventory
|cat4
|cat4
}}
}}

Revision as of 20:06, 28 July 2020

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 (to have it's geometric center at pos) if pos is too far from the geometric center of the object 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>".
  • When scripting attachments meant to rez objects, remember that 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 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.

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
•  LlGetParcelFlags#Examples Test if the parcel allows this script to rez

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