Difference between revisions of "LlRezAtRoot"

From Second Life Wiki
Jump to navigation Jump to search
m
(copied no-copy caveats from llRezObject page)
(31 intermediate revisions by 16 users not shown)
Line 1: Line 1:
{{LSL_Function/inventory|inventory|uuid=false|type=object}}
{{LSL_Function
{{LSL_Function
|func=llRezAtRoot|sort=RezAtRoot
|inject-2={{Issues/SVC-3145}}{{LSL_Function/inventory|inventory|uuid=false|type=object}}{{LSL_Function/position|position|region=*|limit=10 meters}}
|func_id=286|func_sleep=0.1|func_energy=200.0
|func=llRezAtRoot|func_id=286|func_sleep=0.1|func_energy=200.0
|func_footnote=Causes a hard delay based on the mass of the object rezzed.<br>
The function-name is a bit unhappy choosen, because one could understand that the rezing will happen on the root prim. In fact the rezing happens at the link center.<BR>
If you want to rez on the root prim use llRezObject().<BR>
This function should be used with llGetRootPos() and not with llGetPos(), last one should be used with llRezObject().
 
|func_desc=Instantiate '''inventory''' object at '''pos''' with velocity '''vel''' and rotation '''rot''' with start parameter '''param'''
|func_footnote
|p1_type=string|p1_name=inventory
|p1_type=string|p1_name=inventory
|p2_type=vector|p2_name=pos|p2_desc=position
|p2_type=vector|p2_name=position|p2_desc=&#32;to place the object
|p3_type=vector|p3_name=vel|p3_desc=velocity
|p3_type=vector|p3_name=velocity|p3_desc=initial velocity
|p4_type=rotation|p4_name=rot|p4_desc=rotation
|p4_type=rotation|p4_name=rot|p4_desc=initial rotation
|p5_type=integer|p5_name=param|p5_desc=[[on_rez]] event parameter and value returned by [[llGetStartParameter]].
|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_desc=Instantiate {{LSLP|inventory}} object rotated to {{LSLP|rot}} with its root at {{LSLP|position}}, moving at {{LSLP|velocity}}, using {{LSLP|param}} as the start parameter
|func_footnote=To rez an object so its [[llGetGeometricCenter|center]] is at {{LSLP|position}} (instead of the root) use [[llRezObject]] instead.
|constants
|constants
|spec
|spec
|caveats
|caveats=
|examples=<pre>
*Silently fails to rez {{LSLP|inventory}} if {{LSLP|position}} is more than 10 meters away from the prim trying to rez {{LSLP|inventory}}.
// lets admit there is a prim inside the root prim and its called ONIZUKA_PRIM
* 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 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 the issues under Deep Notes for more information.
|examples=
<source lang="lsl2">//Rez an object on touch
string object = "Object";//Object in inventory
integer start_param = 10;
rotation rot;
 
default
{
    state_entry()
    {
        rot = llEuler2Rot(< 0, 90, 90> * DEG_TO_RAD);
    }
    touch_start(integer a)
    {
        vector vec = llGetPos() + < 0.0, 0.0, 5.0>; // 5 meter above this
        vector speed = llGetVel();
        llRezAtRoot(object, vec, speed, rot, start_param);
    }
}</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;


vector onizuka_vec = llGetPos() + < 0.0, 0.0, 5.0>; // 1 meter above the link center
        llRezAtRoot(object, rezPos, rezVel, rezRot, startParam);
rotation onizuka_rot = llEuler2Rot(< 0, 90, 90> * DEG_TO_RAD);
    }
vector onizuka_speed = llGetVel();
}</source>
integer onizuka_start_param = 10
llRezAtRoot("ONIZUKA_PRIM", onizuka_vec, onizuka_speed, onizuka_rot ,onizuka_start_param);
</pre>
|helpers
|helpers
|also_header
|also_header
|also_constants=
{{LSL DefineRow||[[PRIM_TEMP_ON_REZ]]|}}
|also_functions=
|also_functions=
{{LSL DefineRow||[[llRezObject]]|}}
{{LSL DefineRow||[[llRezObject]]|}}
Line 42: Line 78:
|location
|location
|cat1=Rez
|cat1=Rez
|cat2
|cat2=Object
|cat3
|cat3=Inventory
|haiku={{Haiku|Abracadabra!|Velvet ears and twitching nose|Emerge from his hat.}}
|cat4
|cat4
|cat5
|cat6
}}
}}

Revision as of 06:01, 27 July 2016

Summary

Function: llRezAtRoot( string inventory, vector position, vector velocity, rotation rot, integer param );

Instantiate inventory object rotated to rot with its root at position, moving at velocity, using param as the start parameter

• string inventory an object in the inventory of the prim this script is in
• vector position position in region coordinates to place the object
• vector velocity initial velocity
• rotation rot initial 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).

To rez an object so its center is at position (instead of the root) use llRezObject 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 position is more than 10 meters away from the prim trying to rez inventory.
  • 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 the issues under 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

//Rez an object on touch
string object = "Object";//Object in inventory
integer start_param = 10;
rotation rot;

default
{
    state_entry()
    {
        rot = llEuler2Rot(< 0, 90, 90> * DEG_TO_RAD);
    }
    touch_start(integer a)
    {
        vector vec = llGetPos() + < 0.0, 0.0, 5.0>; // 5 meter above this
        vector speed = llGetVel();
        llRezAtRoot(object, vec, speed, rot, start_param);
    }
}
//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;

        llRezAtRoot(object, rezPos, rezVel, rezRot, startParam);
    }
}

See Also

Constants

•  PRIM_TEMP_ON_REZ

Events

•  object_rez triggered when this object rezzes an object from inventory

Functions

•  llRezObject
•  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 llRezAtRoot( string inventory, vector position, vector velocity, rotation rot, integer param );

Haiku

Abracadabra!
Velvet ears and twitching nose
Emerge from his hat.