This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

OSSL BEFEHLE zur NPC BEWEGUNG
#1
OSSL BEFEHLE zur NPC BEWEGUNG

Dieser Artikel ist Teil einer Serie von OSSL Befehlen zur NPC Nutzung in Openim.
Ich habe die Befehle Thematisch gegliedert:

Hier die Befehle zur NPC BEWEGUNG:

osNpcGetPos, osNpcGetRot, 
osNpcSetRot, osNpcMoveTo, osNpcMoveToTarget, osSetSpeed, osNpcStopMoveToTarget







Absolute Position des NPC ermitteln

vector osNpcGetPos(key npc)
Return the current position of the NPC.
Threat Level High
Permissions ${OSSL|osslNPC}
Extra Delay 0 seconds

Ermittelt die absolute Position des per Key/ UUID benannten NPCs in der Sim und gibt dieses Ergebnis als Vektor zurück.







Drehung des NPC abfragen

rotation osNpcGetRot(key npc)
Gets the rotation of the avatar. Only the rotation around the Z plane in Euler rotation (horizontal rotation) has any meaning.
Threat Level High
Permissions ${OSSL|osslNPC}
Extra Delay 0 seconds

Ermittelt die absolute Rotation des per Key/ UUID benannten NPCs in der Sim und gibt dieses Ergebnis als Rotation zurück.
Dabei ist nur der Z Wert tatsächlich beachtenswert. Dieser wird in „Euler“ Notation angegeben.
Euler ist eine Winkeldarstellung in Radians für die Angabe von Kreissegmenten.
Was "Euler" genau ist findet ihr in der Scriptinfo auf Secondlife. Dafür gibt es Umwandlungs Befehle in den LSL Script Funktionen.

Und mit diesen Funktion könnt ihr Euler <-> Rotation wandeln:  
http://wiki.secondlife.com/wiki/LlEuler2Rot
http://wiki.secondlife.com/wiki/LlRot2Euler






NPC drehen

osNpcSetRot(key npc, rotation rot)

Dreht den per Key/UUID benannten NPC auf eine zur Sim absolute Rotation in der Z-Achse.

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

Nur der Z Wert hat einen Funktion:
osNpcSetRot(npc, <0.000000, 0.000000, 1.000000, 0.000000>);  
osNpcSetRot(npc, llEuler2Rot(<0.0, 0.0, PI>));

Beschreibung der Funktion Euler2Rot:    http://wiki.secondlife.com/wiki/LlEuler2Rot







NPC an absolute Position bewegen

osNpcMoveTo(key npc, vector position)
Moves npc to the position.
Threat Level High
Permissions ${OSSL|osslNPC}
Extra Delay 0 seconds

Bewegt den per Key/UUID benannten NPC auf eine zur Sim absolute Position. Die Bewegung erfolgt in einem Schritt wie ein TP.
In diesem Fall wird der NPC bezogen auf seine vorherige Position um 5 m in der X-Achse und -1m der Y-Achse verstetzt.
osNpcMoveTo(npc, llGetPos() + <5.0, -1.0, 0.0>);







NPC in Richtung des Ziels losschicken

osNpcMoveToTarget(key npc, vector target, integer options)

Move the NPC to a given target over time. How the NPC will get there depends on the following options.
OS_NPC_FLY - Fly the NPC to the given position. The avatar will not land unless the OS_NPC_LAND_AT_TARGET option is also given.
OS_NPC_NO_FLY - Do not fly to the target. The NPC will attempt to walk to the location. If it's up in the air then the NPC will keep bouncing hopeless until another move target is given or the move is stopped.
OS_NPC_LAND_AT_TARGET - If given and the NPC is flying, then it will land when it reaches the target. If OS_NPC_NO_FLY is given then this option has no effect.
OS_NPC_FLY and OS_NPC_NO_FLY are options that cannot be combined - the NPC will end up doing one or the other. If you want the NPC to fly and land at the target, then OS_NPC_LAND_AT_TARGET must be combined with OS_NPC_FLY.
OS_NPC_RUNNING - make the NPC run to the given position.
Threat Level High
Permissions ${OSSL|osslNPC}
Extra Delay 0 seconds

Schickt den per Key/UUID benannten NPC los damit er die mit Vektor angegebene Position (irgendwann mal) erreicht.
Die Bewegung erfolgt in einstellbare Geschwindigkeit und dauert eine unbestimmte Zeit.

Die Geschwindigkeit mit der das auf das Ziel zugegangen wird ist mit osSetSpeed einstellbar. (nachfolgend beschrieben)

Die Art und Weise wie er hinkommt ist mit Parametern in „Options“ einstellbar.
So kann man vorgeben ob hin gegangen (kein Option Paramater) oder gelaufen (OS_NPC_RUNNING) wird.

Es ist auch einstellbar ob der Boden verlassen werden darf mittels Flug (OS_NPC_FLY
oder am Boden gegangen werden muss (OS_NPC_NO_FLY).

Falls geflogen wird, so erfolgt die Landung am Zielpunkt nur nach separatem Parameter (OS_NPC_LAND_AT_TARGET).
Mehrere Parameter werden durch „|“ getrennt angegeben.

Beispiel: flieg hin zu einem Ziel das von der aktuellen Position in 5m X und -1m Y entfernt ist. Lande am Ziel wenn es erreicht ist.
osNpcMoveToTarget(npc, llGetPos() + <5.0, -1.0, 0.0>, OS_NPC_FLY | OS_NPC_LAND_AT_TARGET );







Die Bewegungs Geschwindigkeit einstellen

osSetSpeed(key ID, float SpeedModifier)

This allows for users to speed themselves up. It multiplies the running, walking, rotating and flying of the avatar.
The default value for SpeedModifier is 1.0.
To be precise, it affects physical velocity. If you specify too large or too small number for SpeedModifier, the target will be unmovable, showing the following message in the region console:
[PHYSICS]: Got a NaN velocity from Scene in a Character
Threat Level Moderate
Permissions ${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER
Extra Delay 0 seconds

Mit diesem Befehl lässt sich die Laufgeschwindigkeit (für Avatare wie auch NPCs) einstellen. 
Das wirkt auf Befehle aus die ein Laufen, Fliegen, etc beinhalten. 
Im NPC Kontext macht das nur im Zusammenhang mit dem Befehl osNpcMoveToTarget Sinn.

osSetSpeed(llDetectedKey(0), 2.0);  // Doppelte Bewegungs- Geschwindigkeit
osSetSpeed(llDetectedKey(0), 1.0);  // Wieder Normal Geschwingigkeit







NPC Bewegung auf ein (noch nicht erreichtes) Ziel Stoppen

osNpcStopMoveToTarget(key npc)
Stop a current move to a target.
Threat Level High
Permissions ${OSSL|osslNPC}
Extra Delay 0 seconds

Mit diesem Befehl läßt sich ein Laufbefehl der mit osNpcMoveToTarget gegeben wurde wieder aufheben, auch wenn das Ziel noch nicht erreicht ist. Sinn macht das zum Beispiel in Zusammenhang mit einem Timer, der Zuschlägt wenn eine Bewegung zu lange gedauert hat, weil der Weg versperrt ist. Eine andere Anwendung ist Reaktion auf ein vorher nicht bekanntes Event.







Weitere Befehle sind in anderen Artikeln behandelt um die Übersichtlichkeit zu wahren.
Die Original Infos in Englisch findet ihr hier:

http://opensimulator.org/wiki/Scripting_Documentation
Zitieren


Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 2 Gast/Gäste