wiki.sine.space | sinespace

Difference between revisions of "Scripting/SAvatar"

From wiki.sine.space
Jump to: navigation, search
(Replaced content with "This page has moved to: https://docs.sine.space/v/scripting/client-scripting/types/savatar")
 
(41 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The SAvatar class refers a single player avatar active within the scene. This only contains active players with a valid network connection, and does not include NPCs. ((PlayerAvatar being used below is just an example, as it returns an SAvatar.))
+
This page has moved to: https://docs.sine.space/v/scripting/client-scripting/types/savatar
 
+
=Members=
+
 
+
 
+
{{ScriptFunction|void|Detach|();|Detaches the avatar from whatever it may be attached to (only works for the player avatar), including chairs, vehicles and so forth.|5=<pre>Space.Scene.PlayerAvatar.Detach()</pre>}}
+
 
+
{{ScriptFunction|void|AttachTo|(SGameObject target);|Attaches the player to the target game object, keeping the avatar fixed in its current position/rotation relative to the target object (e.g. for use in Vehicles)|5=<pre>Space.Scene.PlayerAvatar.AttachTo(targetObject)</pre>}}
+
 
+
{{ScriptFunction|SGameObject|FindBone|(string bone);|Retrieves the specified bone.|5=
+
<b>-- Best used with non humanoid models</b><br>
+
local bone = Space.Scene.PlayerAvatar.FindBone("Hips/Spine/Chest/LeftShoulder"); -- Gets the bone by path<br>
+
Space.Log(bone.Name); -- Prints the retrieved bones name, which will match the last name in the path specified.<br>
+
 
+
<b>or</b>
+
 
+
<b>-- Best used with humanoid models</b><br>
+
local bone = Space.Scene.PlayerAvatar.FindBone("LeftShoulder"); -- Gets bone by UnityEngine.HumanTrait.BoneName[]<br>
+
Space.Log(bone.Name); -- Prints the bone name of the corresponding search parameter, which when using a default avatar, it will print "LeftShoulder"<br>
+
 
+
--[[<br>
+
<b>UnityEngine.HumanTrait.BoneName[]</b>
+
 
+
<b>Body</b>: Hips, Spine, Chest, UpperChest<br>
+
<b>Head</b>: Neck, Jaw, Head, LeftEye, RightEye<br>
+
 
+
<b>Left Arm</b>: LeftShoulder, LeftUpperArm, LeftLowerArm, LeftHand<br>
+
<b>Left Leg</b>: LeftUpperLeg, LeftLowerLeg, LeftFoot, LeftToes<br>
+
 
+
<b>Right Arm</b>: RightShoulder, RightUpperArm, RightLowerArm, RightHand<br>
+
<b>Right Leg</b>: RightUpperLeg, RightLowerLeg, RightFoot, RightToes<br>
+
 
+
<b>Left Hand (Thumb)</b>: LeftThumbProximal, LeftThumbIntermediate, LeftThumbDistal<br>
+
<b>Left Hand (Index)</b>: LeftIndexProximal, LeftIndexIntermediate, LeftIndexDistal<br>
+
<b>Left Hand (Middle)</b>: LeftMiddleProximal, LeftMiddleIntermediate, LeftMiddleDistal<br>
+
<b>Left Hand (Ring)</b>: LeftRingProximal, LeftRingIntermediate, LeftRingDistal<br>
+
<b>Left Hand (Little)</b>: LeftLittleProximal, LeftLittleIntermediate, LeftLittleDistal<br>
+
 
+
<b>Right Hand (Thumb)</b>: RightThumbProximal, RightThumbIntermediate, RightThumbDistal<br>
+
<b>Right Hand (Index)</b>: RightIndexProximal, RightIndexIntermediate, RightIndexDistal<br>
+
<b>Right Hand (Middle)</b>: RightMiddleProximal, RightMiddleIntermediate, RightMiddleDistal<br>
+
<b>Right Hand (Ring)</b>: RightRingProximal, RightRingIntermediate, RightRingDistal<br>
+
<b>Right Hand (Little)</b>: RightLittleProximal, RightLittleIntermediate, RightLittleDistal<br>
+
]]}}
+
 
+
 
+
=Properties=
+
{{ScriptFunction|string|Username|{ get; }|Returns the avatar's current username (note: this can be changed by players for a small fee)|5=<pre>playerUsername = Space.Scene.PlayerAvatar.Username</pre>}}
+
 
+
{{ScriptFunction|string|Title|{ get; }|Returns the avatar's current title|5=<pre>playerTitle = Space.Scene.PlayerAvatar.Title</pre>}}
+
 
+
{{ScriptFunction|long|ID|{ get; }|Returns the avatar's user ID, please note if you store these, this is a 'long' value not a 'int'.|5=<pre>playerID = Space.Scene.PlayerAvatar.ID</pre>}}
+
 
+
{{ScriptFunction|SGameObject|GameObject|{ get; }|Returns a reference to avatar's GameObject|5=<pre>playerObject = Space.Scene.PlayerAvatar.GameObject</pre>}}
+
 
+
{{ScriptFunction|bool|BlockMovement|{ get;set; }|If set to True, avatar's movement will be blocked|5=<pre>Space.Scene.PlayerAvatar.BlockMovement = true</pre>}}
+
 
+
{{ScriptFunction|bool|Guest|{ get; }|Returns True if avatar is guest|5=<pre>Space.Log(Space.Scene.PlayerAvatar.BlockMovement)</pre>}}
+
 
+
{{ScriptFunction|SGameObject|Skeleton|{ get; }|Returns a reference to avatar's skeleton GameObject|5=<pre>avSkeleton = Space.Scene.PlayerAvatar.Skeleton</pre>}}
+
 
+
{{ScriptFunction|bool|IsAttached|{ get; }|Returns True if avatar is Attached|5=<pre>Space.Log(Space.Scene.PlayerAvatar.isAttached)</pre>}}
+
 
+
{{ScriptFunction|bool|IsGrounded|{ get; }|Returns True if avatar is Grounded|5=<pre>Space.Log(Space.Scene.PlayerAvatar.isGrounded)</pre>}}
+
 
+
{{ScriptFunction|float|JumpHeight|{ get;set; }|How high the avatar's jump is|5=<pre>Space.Scene.PlayerAvatar = 20</pre>}}
+
 
+
{{ScriptFunction|bool|Loaded|{ get; }|Returns true if avatar is Loaded|5=<pre>Space.Log(Space.Scene.PlayerAvatar.Loaded)</pre>}}
+
 
+
{{ScriptFunction|float|MovementSpeed|{ get;set; }|How fast the avatar's movement is|5=<pre>Space.Scene.PlayerAvatar = 20</pre>}}
+
 
+
{{ScriptFunction|long|OutfitID|{ get; }|Returns the current outfit ID of the avatar|5=<pre>avOutfit = Space.Scene.PlayerAvatar.OutfitID</pre>}}
+
 
+
{{ScriptFunction|void|ResetOutfit|();|Reset current outfit.|5=<pre>local avatar=Space.Scene.PlayerAvatar
+
avatar.ResetOutfit()</pre>
+
}}
+
 
+
{{ScriptFunction|void|Register|(string username, string password, string email);|Allow a guest to register.|5=<pre>local avatar=Space.Scene.PlayerAvatar
+
avatar.Register("MyName","MyPassword","MyEmail",false,function ()
+
    Space.Log("Success!")
+
end,function ()
+
    Space.Log("OnError!!")
+
end)</pre>
+
}}
+
 
+
{{ScriptFunction|void|LoadOutfit|(int outfitID);|Only works on a white-label deployment due to abuse concerns.|5=<pre>local avatar=Space.Scene.PlayerAvatar
+
avatar.LoadOutfit(10001)</pre>
+
}}
+
 
+
{{ScriptFunction|void|ResetOutfitToTemplate|(int outfitID);|Reset current outfit to template one.|5=<pre>local avatar=Space.Scene.PlayerAvatar
+
avatar.ResetOutfitToTemplate(10001)</pre>
+
}}
+
 
+
{{ScriptFunction|void|Teleport|(string landmarkName);|Teleport the avatar to the landmark.|5=<pre>local avatar=Space.Scene.PlayerAvatar
+
avatar.Teleport("MyLandMark")</pre>
+
}}
+
 
+
{{ScriptFunction|void|Teleport|(SVector position);|Teleport the avatar to certain position.|5=<pre>local avatar=Space.Scene.PlayerAvatar
+
avatar.Teleport(Vector.Zero)</pre>
+
}}
+
 
+
{{ScriptFunction|void|Teleport|(SVector position, SQuaternion rotation);|Teleport the avatar to certain position and rotation.|5=<pre>local avatar=Space.Scene.PlayerAvatar
+
avatar.Teleport(Vector.Zero,Quaternion.Identity)</pre>
+
}}
+
 
+
{{ScriptFunction|void|Teleport|(int region, SVector position, SQuaternion rotation);|Teleport the avatar to a certain region with certain position and rotation.|5=<pre>local avatar=Space.Scene.PlayerAvatar
+
avatar.Teleport(2342341,Vector.Zero,Quaternion.Identity)</pre>
+
}}
+
 
+
{{ScriptFunction|void|Teleport|(int region);|Teleport the avatar to a certain.|5=<pre>local avatar=Space.Scene.PlayerAvatar
+
avatar.Teleport(2342341)</pre>
+
}}
+
 
+
 
+
{{Scripting Navbox}}
+

Latest revision as of 07:51, 19 September 2022

This page has moved to: https://docs.sine.space/v/scripting/client-scripting/types/savatar