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)

Parameter
Type
Description

Space.Scene.PlayerAvatar.AttachTo(targetObject)
--the below scipt 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).

Parameter
Type
Description

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)

Parameter
Type
Description

ResetOutfitToTemplate

void ResetOutfitToTemplate (int outfitID)

Reset current outfit to a specific template. (white-label only)

Parameter
Type
Description

FindBone

SGameObject FindBone (string bone)

Retrieves the specified bone.

Parameter
Type
Description

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.

Parameter
Type
Description

SetIKGoal

void SetIKGoal (string goal, bool positionGoal, float positionStrength, SVector positionTarget, bool rotationGoal, float rotationStrength, SQuaternion rotationTarget)

Set the IK goal to avatar.

Parameter
Type
Description

ClearIKGoal

void ClearIKGoal (string goal)

Clear the IK Goal.

Parameter
Type
Description

PlayCustomAnimation

void PlayCustomAnimation (SResource animationClip)

Make the avatar plays custom animation.

Parameter
Type
Description

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.

Parameter
Type
Description

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 ()

Takes the avatar out of Fly Mode.

OnAvatarSkeletonReload

void OnAvatarSkeletonReload (Closure o)

This event will be called when the avatar skeleton gets loaded.

Parameter
Type
Description

o

Closure (callback)

A function that will be called once the OnAvatarSkeletonReload event is trigged.

TeleportToNextEvent

double TeleportToNextEvent (long withinSeconds=600)

Function Description

Parameter
Type
Description

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

Property Description

Title

string Title get

Returns the avatar's current title

OrgTitle

string OrgTitle get

Property Description

OrgName

string OrgName get

Property Description

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

Property Description

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