OsNpcSetRot

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Add exemples)
m (Change See Also)
 
(2 intermediate revisions by one user not shown)
Line 9: Line 9:
 
//
 
//
 
// osNpcSetRot Script Exemple
 
// osNpcSetRot Script Exemple
// Authior: djphil
+
// Author: djphil
 
//
 
//
 
   
 
   
Line 59: Line 59:
 
//
 
//
 
// osNpcSetRot Script Exemple
 
// osNpcSetRot Script Exemple
// Authior: djphil
+
// Author: djphil
 
//
 
//
 
   
 
   
Line 107: Line 107:
 
|additional_info=This function was added in 0.7.2-post-fixes
 
|additional_info=This function was added in 0.7.2-post-fixes
 
}}
 
}}
 +
== See Also ==
 +
* [[osNpcGetPos]]
 +
* [[osNpcGetRot]]
 +
* [[osNpcSetRot]]
 +
* [[osNpcMoveTo]]
 +
* [[osNpcMoveToTarget]]
 +
* [[osNpcStopMoveToTarget]]

Latest revision as of 18:54, 5 December 2020

osNpcSetRot(key npc, rotation rot)
Set the rotation of the avatar. Only setting the rotation in the Z plane in Euler rotation will have any meaningful effect (turning the avatar to point in one direction or another). Setting X or Y Euler values will result in the avatar rotating in an undefined manner.
Threat Level High
Permissions ${OSSL|osslNPC}
Extra Delay 0 seconds
Example(s)
//
// osNpcSetRot Script Exemple
// Author: djphil
//
 
key npc;
 
default
{
    state_entry()
    {
        llSay(PUBLIC_CHANNEL, "Touch to see osNpcSetRot usage.");
    }
 
    touch_start(integer number)
    {
        key toucher = llDetectedKey(0);
        vector npcPos = llGetPos() + <1.0, 0.0, 1.0>;
        osAgentSaveAppearance(toucher, "appearance");
        npc = osNpcCreate("ImYour", "Clone", npcPos, "appearance");
        state hasNPC;
    }
}
 
state hasNPC
{
    state_entry()
    {
        llSetTimerEvent(5.0);
    }
 
    timer()
    {
        llSetTimerEvent(0.0);
        osNpcSay(npc, "Hello world!");
        osNpcSetRot(npc, <0.000000, 0.000000, 1.000000, 0.000000>);
    }
 
    touch_start(integer number)
    {
        osNpcSay(npc, "Goodbye!");
        llSetTimerEvent(0.0);
        osNpcRemove(npc);
        npc = NULL_KEY;
        state default;
    }
}

Or with llEuler2Rot

//
// osNpcSetRot Script Exemple
// Author: djphil
//
 
key npc;
 
default
{
    state_entry()
    {
        llSay(PUBLIC_CHANNEL, "Touch to see osNpcSetRot usage.");
    }
 
    touch_start(integer number)
    {
        key toucher = llDetectedKey(0);
        vector npcPos = llGetPos() + <1.0, 0.0, 1.0>;
        osAgentSaveAppearance(toucher, "appearance");
        npc = osNpcCreate("ImYour", "Clone", npcPos, "appearance");
        state hasNPC;
    }
}
 
state hasNPC
{
    state_entry()
    {
        llSetTimerEvent(5.0);
    }
 
    timer()
    {
        llSetTimerEvent(0.0);
        osNpcSay(npc, "Hello world!");
        osNpcSetRot(npc, llEuler2Rot(<0.0, 0.0, PI>));
    }
 
    touch_start(integer number)
    {
        osNpcSay(npc, "Goodbye!");
        llSetTimerEvent(0.0);
        osNpcRemove(npc);
        npc = NULL_KEY;
        state default;
    }
}
Notes
This function was added in 0.7.2-post-fixes


[edit] See Also

Personal tools
General
About This Wiki