(Added simple examples to .Detach() .AttachTo() .Username .Title .ID .GameObject) |
m |
||
Line 45: | Line 45: | ||
− | + | =Properties= | |
{{ScriptFunction|string|Username|{ get; }|Returns the players current username (note: this can be changed by players for a small fee)|5=<pre>playerUsername = Space.Scene.PlayerAvatar.Username</pre>}} | {{ScriptFunction|string|Username|{ get; }|Returns the players current username (note: this can be changed by players for a small fee)|5=<pre>playerUsername = Space.Scene.PlayerAvatar.Username</pre>}} | ||
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.
Detaches the avatar from whatever it may be attached to (only works for the player avatar), including chairs, vehicles and so forth.
Space.Scene.PlayerAvatar.Detach()
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)
Space.Scene.PlayerAvatar.AttachTo(targetObject)
Retrieves the specified bone.
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"
--[[
UnityEngine.HumanTrait.BoneName[]
Body: Hips, Spine, Chest, UpperChest
Head: Neck, Jaw, Head, 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
Returns the players current username (note: this can be changed by players for a small fee)
playerUsername = Space.Scene.PlayerAvatar.Username
Returns the players current title
playerTitle = Space.Scene.PlayerAvatar.Title
Returns the players user ID, please note if you store these, this is a 'long' value not a 'int'.
playerID = Space.Scene.PlayerAvatar.ID
Returns a reference to the players GameObject
playerObject = Space.Scene.PlayerAvatar.GameObject
|