OsNpcLookAt

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(More description)
Line 8: Line 8:
  
 
* npckey : The key of the npc.
 
* npckey : The key of the npc.
* type : the type of the lookat a integer < 11, for now, not that clear how viewers do handle them
+
* type : the type of the lookat
 
* targetkey : a object or avatar target
 
* targetkey : a object or avatar target
* offset : a offset relative to that target or if target is nullkey a GLOBAL position.
+
* offset : a offset relative to that target in target local coordinates, or if target is nullkey a GLOBAL position.
  
To set "normal" look fw osNpcLookAt
+
This sends a viewer lookat effect relative to that npc to all avatars in region.
osNpcLookAt(npckey, 1, npckey, <2.5, 0.0, 0.0>); // (target is the npc, offset = positive x)
+
This will make those viewers to turn the npc head and eyes in the target position plus offset, if the current head animation priority is lower than viewers defined head movement priority, usually 1.
 +
 
 +
type defines what kind of event or attention. They have viewer defined priorities relative to each other
 +
Only the one with higher priority will play.
 +
 
 +
type constants:
 +
 
 +
* NPCLOOKAT_NONE = 0; nothing
 +
* NPCLOOKAT_IDLE = 1; mouse movements
 +
* NPCLOOKAT_LISTEN = 2; listing to nearby chat
 +
* NPCLOOKAT_FREELOOK = 3;
 +
* NPCLOOKAT_RESPOND = 4; begin of typing
 +
* NPCLOOKAT_HOVER = 5; mouse hovering on a object
 +
* NPCLOOKAT_CONVERSATION = 6;
 +
* NPCLOOKAT_SELECT = 7; object grabbed
 +
* NPCLOOKAT_FOCUS = 8; focused on a object or point
 +
* NPCLOOKAT_MOUSELOOK = 9; mouse look
 +
* NPCLOOKAT_CLEAR = 10; should clear current one ?
 +
 
 +
What does happen to the npc is viewer dependent
 +
 
 +
For example to set normal look forward like iddle mouse osNpcLookAt(npckey, 1, npckey, <2.5, 0.0, 0.0>); // (looks to npc position plus 2.5m on x that is its front direction)
  
 
|threat_level=ignored
 
|threat_level=ignored
 
|permissions=true
 
|permissions=true
 
|delay=0
 
|delay=0
|ossl_example=<source lang="lsl">
 
//
 
// Example of osNpcLookAt
 
//
 
 
default
 
{
 
    state_entry()
 
    {
 
        ...
 
        osNpcLookAt(...);
 
        ...
 
    }
 
}
 
</source>
 
 
|additional_info=This function was added in 0.9.2.0
 
|additional_info=This function was added in 0.9.2.0
 
}}
 
}}

Revision as of 01:04, 17 February 2021

integer osNpcLookAt(key npckey, integer type, key targetkey, vector offset)

Caution ! still experimental, subject to changes

  • npckey : The key of the npc.
  • type : the type of the lookat
  • targetkey : a object or avatar target
  • offset : a offset relative to that target in target local coordinates, or if target is nullkey a GLOBAL position.

This sends a viewer lookat effect relative to that npc to all avatars in region. This will make those viewers to turn the npc head and eyes in the target position plus offset, if the current head animation priority is lower than viewers defined head movement priority, usually 1.

type defines what kind of event or attention. They have viewer defined priorities relative to each other Only the one with higher priority will play.

type constants:

  • NPCLOOKAT_NONE = 0; nothing
  • NPCLOOKAT_IDLE = 1; mouse movements
  • NPCLOOKAT_LISTEN = 2; listing to nearby chat
  • NPCLOOKAT_FREELOOK = 3;
  • NPCLOOKAT_RESPOND = 4; begin of typing
  • NPCLOOKAT_HOVER = 5; mouse hovering on a object
  • NPCLOOKAT_CONVERSATION = 6;
  • NPCLOOKAT_SELECT = 7; object grabbed
  • NPCLOOKAT_FOCUS = 8; focused on a object or point
  • NPCLOOKAT_MOUSELOOK = 9; mouse look
  • NPCLOOKAT_CLEAR = 10; should clear current one ?

What does happen to the npc is viewer dependent

For example to set normal look forward like iddle mouse osNpcLookAt(npckey, 1, npckey, <2.5, 0.0, 0.0>); // (looks to npc position plus 2.5m on x that is its front direction)

Threat Level This function does not do a threat level check
Permissions Use of this function is always allowed by default
Extra Delay 0 seconds
Notes
This function was added in 0.9.2.0


Personal tools
General
About This Wiki