SAvatar
Functions
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)
Space.Scene.PlayerAvatar.AttachTo(targetObject)--the below script makes the player Attach/Detach to/from this object by clicking it
--(Example: Seat/Vehicle/Experience etc.. )
thisGameObject = Space.Host.ExecutingObject
isAttached = 0
OnClick = function()
if isAttached == 0 then
Space.Scene.PlayerAvatar.AttachTo(thisGameObject)
isAttached = 1
elseif isAttached == 1 then
Space.Scene.PlayerAvatar.Detach()
isAttached = 0
end
end
thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip = "Click to Attach/Detach yourself to/from me"
thisGameObject.Clickable.OnClick(OnClick) 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.
OnAvatarAttached
void OnAvatarAttached ()
An event which fires whenever this avatar is attached to a game object in the current scene.
OnAvatarDetached
void OnAvatarDetached ()
An event which fires whenever this avatar is detached from a game object in the current scene.
LoadOutfit
void LoadOutfit (int outfitID)
Only works on a white-label deployment due to abuse concerns. Restrictions: The outfit ID needs to be one of the grid template outfits, with all the restrictions that apply to those (i.e. must use either SW content, or content uploaded by a grid admin account).
ResetOutfit
void ResetOutfit ()
Reset current outfit. (white-label only)
Register
void Register (string username, string password, string email, bool subscribeToSinespaceNewsletter=false, Closure onSuccess=null, Closure onError=null)
Allow a guest to register. (white-label only)
ResetOutfitToTemplate
void ResetOutfitToTemplate (int outfitID)
Reset current outfit to a specific template. (white-label only)
FindBone
SGameObject FindBone (string bone)
Retrieves the specified humanoid bone as an SGameObject. Requires a Humanoid rig; returns nil if the bone is missing or the avatar is non‑humanoid. The name is matched case‑insensitively against UnityEngine.HumanBodyBones.
bone
string
Name of a UnityEngine.HumanBodyBones value (case‑insensitive), e.g., "LeftShoulder", "Head".
Teleport
void Teleport (string landmarkName) void Teleport (SVector position) void Teleport (SVector position, SQuaternion rotation) void Teleport (int region) void Teleport (int region, SVector position, SQuaternion rotation)
Teleport the avatar.
SetIKGoal
void SetIKGoal (string goal, bool positionGoal, float positionStrength, SVector positionTarget, bool rotationGoal, float rotationStrength, SQuaternion rotationTarget)
Set the IK goal to avatar.
ClearIKGoal
void ClearIKGoal (string goal)
Clear the IK Goal.
PlayCustomAnimation
void PlayCustomAnimation (SResource animationClip)
Play a custom animation on the avatar.
StopCustomAnimation
void StopCustomAnimation ()
Make the avatar stops playing custom animation.
OnAvatarReload
void OnAvatarReload (Closure o)
This event will be called when the avatar gets loaded.
o
Closure (callback)
A function that will be called once the OnAvatarReload event is triggered.
SynchroniseState
void SynchroniseState ()
Synchronise avatar's state to network.
StartFly
void StartFly ()
Puts the avatar into Fly Mode.
EndFly
void EndFly ()
Exits Avatar out of Fly Mode
OnAvatarSkeletonReload
void OnAvatarSkeletonReload (Closure o)
This event will be called when the avatar skeleton gets loaded.
o
Closure (callback)
A function that will be called once the OnAvatarSkeletonReload event is triggered.
TeleportToNextEvent
double TeleportToNextEvent (long withinSeconds=600)
Teleports to the region of the next scheduled event if it starts within the given time window. Returns 0 if a teleport occurs; returns the number of seconds until the next event if it is outside the cutoff; returns -1 if there are no upcoming events.
withinSeconds
long
Maximum seconds ahead to consider for auto-teleport. Defaults to 600.
Properties
Username
string Username get
Returns the avatar's current username (note: this can be changed by players for a small fee)
DisplayName
string DisplayName get
Returns the avatar's display name (falls back to Username if unset).
Title
string Title get
Returns the avatar's current title
OrgTitle
string OrgTitle get
Returns the user's organizational job title (JobTitle).
OrgName
string OrgName get
Returns the user's organization/company name (Company).
ID
long ID get
Returns the avatar's user ID, please note if you store these, this is a 'long' value not a 'int'.
IsAttached
bool IsAttached get
Returns True if avatar is Attached
MovementSpeed
float MovementSpeed get set
How fast the avatar's movement is
JumpHeight
float JumpHeight get set
How high the avatar's jump is
Guest
bool Guest get
Is this Avatar a Guest?
OutfitID
long OutfitID get
Returns the current outfit ID of the avatar
Loaded
bool Loaded get
Returns true if avatar is Loaded
Gender
string Gender get
Returns the avatar's gender as a string (e.g., "Male", "Female").
LockObject
SGameObject LockObject get
The object the Avatar is Attached to. Returns Null if Avatar is not attached.
Skeleton
SGameObject Skeleton get
Returns a reference to avatar's skeleton GameObject
BlockMovement
bool BlockMovement get set
If set to True, avatar's movement will be blocked
BlockRun
bool BlockRun get set
Is the Avatar blocked from running?
BlockFly
bool BlockFly get set
Is the Avatar blocked from flying?
BlockCrouch
bool BlockCrouch get set
Is the Avatar blocked from crouching?
BlockJump
bool BlockJump get set
Is the Avatar blocked from jumping?
IsGrounded
bool IsGrounded get
Returns True if avatar is Grounded
GameObject
SGameObject GameObject get
The reference to the Avatar's GameObject
Last updated
Was this helpful?

