wiki.sine.space | sinespace

Difference between revisions of "Scripting/SAvatar"

From wiki.sine.space
Jump to: navigation, search
(Created page with "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. =Member...")
 
(Members)
Line 9: Line 9:
 
{{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.}}
 
{{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.}}
 
{{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)}}
 
{{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)}}
 +
{{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>
 +
 +
--[[ <b>Bone names</b><br>
 +
<b>Body</b>: Hips, Spine, Chest, UpperChest<br>
 +
<b>Head</b>: Neck, Head, Jaw<br>
 +
<b>Eyes</b>: 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>
 +
]]}}
  
 
{{Scripting Navbox}}
 
{{Scripting Navbox}}

Revision as of 21:23, 15 September 2017

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.

Members

Username

string Username { get; }

Returns the players current username (note: this can be changed by players for a small fee)

No example provided yet


Title

string Title { get; }

Returns the players current title

No example provided yet


ID

long ID { get; }

Returns the players user ID, please note if you store these, this is a 'long' value not a 'int'.

No example provided yet


GameObject

SGameObject GameObject { get; }

Returns a reference to the players GameObject

No example provided yet


Detach

void Detach ();

Detaches the avatar from whatever it may be attached to (only works for the player avatar), including chairs, vehicles and so forth.

No example provided yet


AttachTo

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)

No example provided yet


FindBone

SGameObject FindBone (string bone);

Retrieves the specified bone.

-- Best used with non humanoid models

local bone = Space.Scene.PlayerAvatar.FindBone("Hips/Spine/Chest/LeftShoulder"); -- Gets the bone by path
Space.Log(bone.Name); -- Prints the retrieved bones name, which will match the last name in the path specified.

or

-- Best used with humanoid models
local bone = Space.Scene.PlayerAvatar.FindBone("LeftShoulder"); -- Gets bone by UnityEngine.HumanTrait.BoneName[]
Space.Log(bone.Name); -- Prints the bone name of the corresponding search parameter, which when using a default avatar, it will print "LeftShoulder"

--[[ Bone names
Body: Hips, Spine, Chest, UpperChest
Head: Neck, Head, Jaw
Eyes: LeftEye, RightEye

Left Arm: LeftShoulder, LeftUpperArm, LeftLowerArm, LeftHand
Left Leg: LeftUpperLeg, LeftLowerLeg, LeftFoot, LeftToes

Right Arm: RightShoulder, RightUpperArm, RightLowerArm, RightHand
Right Leg: RightUpperLeg, RightLowerLeg, RightFoot, RightToes

Left Hand (Thumb): LeftThumbProximal, LeftThumbIntermediate, LeftThumbDistal
Left Hand (Index): LeftIndexProximal, LeftIndexIntermediate, LeftIndexDistal
Left Hand (Middle): LeftMiddleProximal, LeftMiddleIntermediate, LeftMiddleDistal
Left Hand (Ring): LeftRingProximal, LeftRingIntermediate, LeftRingDistal
Left Hand (Little): LeftLittleProximal, LeftLittleIntermediate, LeftLittleDistal

Right Hand (Thumb): RightThumbProximal, RightThumbIntermediate, RightThumbDistal
Right Hand (Index): RightIndexProximal, RightIndexIntermediate, RightIndexDistal
Right Hand (Middle): RightMiddleProximal, RightMiddleIntermediate, RightMiddleDistal
Right Hand (Ring): RightRingProximal, RightRingIntermediate, RightRingDistal
Right Hand (Little): RightLittleProximal, RightLittleIntermediate, RightLittleDistal

]]