All pages
Powered by GitBook
1 of 44

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Types

SAnimationState

Index

Properties Index

Property Name

Properties

Enabled

bool Enabled get set

Is this Animation State enabled?

Length

float Length get

Returns the length of current animation.

Name

string Name get

Returns the name of current animation.

NormalizedSpeed

float NormalizedSpeed get set

Returns the normalized speed of current animation.

NormalizedTime

float NormalizedTime get set

Returns the normalized time of current animation.

Speed

float Speed get set

The playback speed of the animation. 1.0 is normal playback speed.

Time

float Time get set

Returns the Time of current animation.

Weight

float Weight get set

Returns the Weight of current animation.

bool Enabled get set

float Length get

string Name get

float NormalizedSpeed get set

float NormalizedTime get set

float Speed get set

float Time get set

float Weight get set

SAnimationState = Space.Host.ExecutingObject.Animation.GetState()
SAnimationState.Enabled = false
SAnimationState = Space.Host.ExecutingObject.Animation.GetState()
length = SAnimationState.Length
SAnimationState = Space.Host.ExecutingObject.Animation.GetState()
name = SAnimationState.Name
SAnimationState = Space.Host.ExecutingObject.Animation.GetState()
normalizedSpeed = SAnimationState.NormalizedSpeed
SAnimationState = Space.Host.ExecutingObject.Animation.GetState()
normalizedTime = SAnimationState.NormalizedTime
SAnimationState = Space.Host.ExecutingObject.Animation.GetState()
SAnimationState.Speed = 0.5
SAnimationState = Space.Host.ExecutingObject.Animation.GetState()
SAnimationState.Time = 0.5
SAnimationState = Space.Host.ExecutingObject.Animation.GetState()
SAnimationState.Weight = 0.5

SNetworkMessageLua

SCommandBuffer

DrawRenderer

void DrawRenderer (SRenderer renderer, SMaterial material)

Add a "draw renderer" command.

Parameter
Type
Description

Blit

void Blit ( mat)

Add a "bit into a render texture" command.

Parameter
Type
Description

SMusicStationList

Index

Properties Index

Property

Properties

TuneIn

TuneIn get set

Property Description

Station

List< > Station get set

Property Description

SScore

Index

Properties Index

Property

SSubRegion

Index

Properties Index

Property

SSocialMedia

Index

Properties Index

Property Name

SMaterial
commandbuffer=Space.PostFX.CreateCommandBuffer()
mat=Space.Resources[1]
cube=Space.Host.GetReference("Cube")
commandbuffer.DrawRenderer(cube.Renderer,mat.AsMaterial)
Space.PostFX.AddCommandBufferToCamera(commandbuffer)
commandbuffer=Space.PostFX.CreateCommandBuffer()
mat=Space.Resources[1]
commandbuffer.Blit(mat.AsMaterial)
Space.PostFX.AddCommandBufferToCamera(commandbuffer)

STuneIn TuneIn get set

List< SMusicStation > Station get set

STuneIn
SMusicStation
example 1
example 2
example 1
example 2

int get

long get

string get

Properties

Rank

int Rank get

Property Description

example 1
example 2

Score

long Score get

Property Description

Username

string Username get

Property Description

int get

int get

string get

Properties

RegionID

int RegionID get

Property Description

example 1
example 2

Count

int Count get

Property Description

ServerLocation

string ServerLocation get

Property Description

string get

string get

string get

Properties

Type

string Type get

Property Description

tableOfSSocialMedia = Space.Profile.ActivePlayerProfile.SocialMediaProfiles
profileType = tableOfSSocialMedia[1].Type

MediaID

string MediaID get

Property Description

Url

string Url get

Property Description

SAnimatorStateInfo

Index

Functions Index

Function Name

Properties Index

Property Name

Functions

IsName

bool IsName (string name)

Does name match the name of the active state in the statemachine?

Parameter
Type
Description

IsTag

bool IsTag (string tag)

Does tag match the tag of the active state in the statemachine.

Parameter
Type
Description

Properties

fullPathHash

int fullPathHash get

The full path hash for this state. The hash is generated using Animator.StringToHash.

nameHash

int nameHash get

The hashed name of the State.

shortNameHash

int shortNameHash get

The hash is generated using SAnimator.StringToHash. The hash does not include the name of the parent layer.

normalizedTime

float normalizedTime get

Normalized time of the State. The integer part is the number of time a state has been looped. The fractional part is the % (0-1) of progress in the current loop.

length

float length get

Current duration of the state. In seconds Can vary when the State contains a Blend Tree.

speed

float speed get

The playback speed of the animation. 1 is the normal playback speed. A negative playback speed will play the animation from the end.

speedMultiplier

float speedMultiplier get

_The speed multiplier for this state.

A negative speed multiplier will play the animation backwards. If no speed parameter as been set for this SAnimatorState, the default value will be 1._

tagHash

int tagHash get

_The Tag of the State.

The hash is generated using SAnimator.StringToHash._

loop

bool loop get

Is the state looping. All animations in the state must be looping.

Length

float Length get

Current duration of the state. In seconds Can vary when the State contains a Blend Tree

STrackInfo

Index

Properties Index

Property

Properties

Title

string Title get

Title of the track

Artist

string Artist get

Artist of the track

SOutfit

Index

Functions Index

Function

Properties Index

Property

Functions

GetPreview

void GetPreview (Closure onComplete)

Function Description

Parameter
Type
Description

Properties

ID

int ID get

Property Description

Name

string Name get

Property Description

STuneIn

Index

Properties Index

Property

Properties

Base

string Base get set

Property Description

Basem3u

string Basem3u get set

Property Description

Basexspf

string Basexspf get set

Property Description

SWebResponse

Index

Properties Index

Property Name

Properties

Error

string Error get

Any error, will be empty or null if the request was successful

Response

string Response get

The body text of the webpage response if error is empty or null

SGenre

Index

Functions Index

Function Name

SLandmark

Properties Index

Property Name
example 1
example 2
example 1
example 2
example 1
example 2
example 1
example 2
tableOfSSocialMedia = Space.Profile.ActivePlayerProfile.SocialMediaProfiles
profileID = tableOfSSocialMedia[1].MediaID
tableOfSSocialMedia = Space.Profile.ActivePlayerProfile.SocialMediaProfiles
profileType = tableOfSSocialMedia[1].Url
Rank
Score
Username
RegionID
Count
ServerLocation
Type
MediaID
Url

string Title get

string Artist get

otc = function(trackInfo)
Space.Log(trackInfo.Title)
  end
Space.Host.ExecutingObject.Radio.OnTrackChange(otc)

void GetPreview (Closure onComplete)

int ID get

string Name get

example 1
example 2

string Base get set

string Basem3u get set

string Basexspf get set

example 1
example 2

string Error

string Response

function ResponseFunction(responseData)
stringError = responseData.Error
end
Space.WebServices.Get('aURL', ResponseFunction)
otc = function(trackInfo)
Space.Log(trackInfo.Artist)
  end
Space.Host.ExecutingObject.Radio.OnTrackChange(otc)
example 1
example 2
example 1
example 2
example 1
example 2
example 1
example 2
function ResponseFunction(responseData)
stringResponse = responseData.Response
end
Space.WebServices.Get('aURL', ResponseFunction)

override string ()

Properties Index

Property Name

string get set

string get set

string get set

string get set

Functions

ToString

override string ToString ()

Function Description

Parameter
Type
Description

example 1

Properties

Name

string Name get set

Property Description

ID

string ID get set

Property Description

HasChildren

string HasChildren get set

Property Description

ParentID

string ParentID get set

Property Description

float get

SLandmarkType get

Properties

Name

string Name get

Landmark's Name

LandmarkName = Space.Scene.Landmarks[1].Name

Position

SVector Position get

Landmark's Position

Rotation

SQuaternion Rotation get

Landmark's Rotation

SpawnPoint

bool SpawnPoint get

Is this Landmark a spawn point?

SpawnRadius

float SpawnRadius get

The size of the radius around the Landmark where players spawn within

Type

int Type get

The type of Landmark 1= LandingZone, 2= Area, 3= Shop, 4= Quest,5= Activity, 6= Teleport, 7= Music, 8= Dance, 9= Clothes, 10= Vehicle, 11= Item

string Name get

SVector Position get

SQuaternion Rotation get

bool get

bool IsName (string name)

bool IsTag (string tag)

int fullPathHash get

int nameHash get

int shortNameHash get

float normalizedTime get

float length get

float speed get

float speedMultiplier get

int tagHash get

bool loop get

float get

SChatMessage

Index

Properties Index

Attribute Name

Properties

SenderID

uint SenderID get

ID of the sender of the message

Sender

string Sender get

Name of the sender of the message

Channel

string Channel get

Name of the channel

Message

string Message get

The contents of the chat message

SScoreRank

Index

Properties Index

Property

Properties

Level

int Level get

The level of current activity.

AllTimeLeaderboard

SScore[] AllTimeLeaderboard get

The AllTimeLeaderboard of current activity.

DailyLeaderboard

SScore[] DailyLeaderboard get

The daily Leaderboard of current activity.

AllTimePlayerRecord

SScore AllTimePlayerRecord get

The AllTimePlayerRecord of current activity.

DailyPlayerRecord

SScore DailyPlayerRecord get

The daily player records of current activity.

SInventoryItem

Index

Functions Index

Function Name

Properties Index

Property Name

Functions

StoreCustomData

bool StoreCustomData (string data)

Updates the inventory items custom data, and requests a synchronisation with the inventory server. It may not update on the server immediately, but all local calls will reflect the new data. Note: this request can be rate limited and should only be called from a user initiated action (such as clicking a button). Updates to custom data must not be initiated on a timer or regular automatic event. Access to this function can be blacklisted to specific creators if abused.

Parameter
Type
Description

Use

void Use ()

Player will 'Use' this item. (White-label only)

Delete

void Delete ()

Player will 'Delete' this item. (White-label only)

Properties

MasterID

long MasterID get

The master ID for this item - also known as the Curator ID or Item ID, this is the ID for the master item from which this copy exists.

PlayerItemID

long PlayerItemID get

The instance ID for this item - this is guaranteed to be unique per inventory item

Name

string Name get

Returns the name of the inventory item

Description

string Description get

Returns the registered description of the inventory item in the users locale

Brand

string Brand get

Returns brand information about the item

CustomData

string CustomData get

Returns any custom data associated with this item, typically used for 'game' items

SRay

Index

Properties Index

Property

Properties

Origin

Origin get

The origin point of the ray.

Direction

Direction get

The direction of the ray.

SPhysicsHit

Index

Properties Index

Property

SMusicStation

Index

Functions Index

Function

SUserRegions

Index

Properties Index

Property

SResource

Index

Properties Index

Property

SMusicDirectory

Index

Functions Index

Function
example 2
example 1
example 2
example 1
example 2
example 1
example 2
example 1
example 2
LandmarkPosition = Space.Scene.Landmarks[1].Position
LandmarkRotation = Space.Scene.Landmarks[1].Rotation
LandmarkSpawnPoint = Space.Scene.Landmarks[1].SpawnPoint
LandmarkSpawnRadius = Space.Scene.Landmarks[1].SpawnRadius
LandmarkType = Space.Scene.Landmarks[1].Type
AnimationStateInfo = Space.Host.ExecutingObject.Animator.GetCurrentAnimationStateInfo(0)
AnimationStateInfo.isName("aStateName")
AnimationStateInfo = Space.Host.ExecutingObject.Animator.GetCurrentAnimationStateInfo(0)
AnimationStateInfo.isTag("aStateTag")
AnimationStateInfo = Space.Host.ExecutingObject.Animator.GetCurrentAnimationStateInfo(0)
fullPathHash = AnimationStateInfo.fullPathHash
AnimationStateInfo = Space.Host.ExecutingObject.Animator.GetCurrentAnimationStateInfo(0)
nameHash= AnimationStateInfo.nameHash
AnimationStateInfo = Space.Host.ExecutingObject.Animator.GetCurrentAnimationStateInfo(0)
shortNameHash= AnimationStateInfo.shortNameHash
AnimationStateInfo = Space.Host.ExecutingObject.Animator.GetCurrentAnimationStateInfo(0)
normalizedTime= AnimationStateInfo.normalizedTime
AnimationStateInfo = Space.Host.ExecutingObject.Animator.GetCurrentAnimationStateInfo(0)
length= AnimationStateInfo.length
AnimationStateInfo = Space.Host.ExecutingObject.Animator.GetCurrentAnimationStateInfo(0)
speed= AnimationStateInfo.speed
AnimationStateInfo = Space.Host.ExecutingObject.Animator.GetCurrentAnimationStateInfo(0)
speedMultiplier= AnimationStateInfo.speedMultiplier
AnimationStateInfo = Space.Host.ExecutingObject.Animator.GetCurrentAnimationStateInfo(0)
tagHash= AnimationStateInfo.tagHash
AnimationStateInfo = Space.Host.ExecutingObject.Animator.GetCurrentAnimationStateInfo(0)
loop= AnimationStateInfo.loop
AnimationStateInfo = Space.Host.ExecutingObject.Animator.GetCurrentAnimationStateInfo(0)
Length= AnimationStateInfo.Length
Length
ToString
Name
ID
HasChildren
ParentID
SpawnPoint
SpawnRadius
Type

uint SenderID get

string Sender get

string Channel get

string Message get

function oc(chatm)
  Space.Log(chatm.SenderID)
end
Space.Network.Chat.OnChat(oc)
--this script processes every new chat message and makes a UIText display the Sender's ID
uiText = Space.Host.GetReference("text").UIText --Add this Text object as reference in Scripting Runtime

OnChatFunction = function(SChatMessage)
uiText.Text = SChatMessage.SenderID 
end

Space.Network.Chat.OnChat(OnChatFunction) 

int Level get

SScore[] AllTimeLeaderboard get

SScore[] DailyLeaderboard get

SScore AllTimePlayerRecord get

SScore DailyPlayerRecord get

Space.Activity.FinishActivity(99956,100,0,function (rank)
    Space.Log(rank.Level)
end)

bool StoreCustomData (string data)

void Use ()

void Delete ()

long MasterID get

long PlayerItemID get

string Name get

string Description get

string Brand get

string CustomData get

SVector Origin get

SVector Direction get

SVector
SVector
ray=Space.Camera.ScreenCoordinatesToRay(Vector.New(0.5,0.5,0))
rayOrigin = ray.Origin
  --this script will make this object jump to wherever you right click
--(Example: moving objects with right click )

thisGameObject = Space.Host.ExecutingObject


OnUpdate = function()
  if Space.Input.GetMouseDown(1) then
   clickRay = Space.Camera.ScreenCoordinatesToRay(Space.Input.MousePosition)
  rayCastHit = Space.Physics.RayCastSingle(clickRay.Origin, clickRay.Direction, 50.0)
  thisGameObject.WorldPosition = rayCastHit.Position
  end
end

thisGameObject.SubscribeToEvents()
thisGameObject.OnUpdate(OnUpdate)  
function oc(chatm)
  Space.Log(chatm.Sender)
end
Space.Network.Chat.OnChat(oc)
--this script processes every new chat message and makes a UIText display the Sender name
uiText = Space.Host.GetReference("text").UIText --Add this Text object as reference in Scripting Runtime

OnChatFunction = function(SChatMessage)
uiText.Text = SChatMessage.Sender 
end

Space.Network.Chat.OnChat(OnChatFunction) 
function oc(chatm)
  Space.Log(chatm.Channel)
end
Space.Network.Chat.OnChat(oc)
--this script processes every new chat message and makes a UIText display the channel's name
uiText = Space.Host.GetReference("text").UIText --Add this Text object as reference in Scripting Runtime

OnChatFunction = function(SChatMessage)
uiText.Text = SChatMessage.Channel
end

Space.Network.Chat.OnChat(OnChatFunction) 
function oc(chatm)
  Space.Log(chatm.Message)
end
Space.Network.Chat.OnChat(oc)
--this script processes every new chat message and makes a UIText display the Message 
uiText = Space.Host.GetReference("text").UIText --Add this Text object as reference in Scripting Runtime

OnChatFunction = function(SChatMessage)
uiText.Text = SChatMessage.Message 
end

Space.Network.Chat.OnChat(OnChatFunction) 
Space.Activity.FinishActivity(99956,100,0,function (rank)
    local leaderBoard=rank.AllTimeLeaderboard
    for i=1,#leaderBoard do
    Space.Log(leaderBoard[i].Rank)
    Space.Log(leaderBoard[i].Score)
    Space.Log(leaderBoard[i].Username)
    end
end)
Space.Activity.FinishActivity(99956,100,0,function (rank)
    local leaderBoard=rank.DailyLeaderboard
    for i=1,#leaderBoard do
    Space.Log(leaderBoard[i].Rank)
    Space.Log(leaderBoard[i].Score)
    Space.Log(leaderBoard[i].Username)
    end
end)
Space.Activity.FinishActivity(99956,100,0,function (rank)
    local record=rank.AllTimePlayerRecord
    Space.Log(record.Rank)
    Space.Log(record.Score)
    Space.Log(record.Username)
end)
Space.Activity.FinishActivity(99956,100,0,function (rank)
    local record=rank.DailyPlayerRecord
    Space.Log(record.Rank)
    Space.Log(record.Score)
    Space.Log(record.Username)
end)
Items = Space.Inventory.Items
Items[1].StoreCustomData('data1data2data3')
Items = Space.Inventory.Items
Items[1].Use() 
Items = Space.Inventory.Items
Items[1].Delete()
Items = Space.Inventory.Items
iMasterID = Items[1].MasterID
Items = Space.Inventory.Items
iPlayerItemID= Items[1].PlayerItemID
Items = Space.Inventory.Items
iName= Items[1].Name
Items = Space.Inventory.Items
iDescription=Items[1].Description
Items = Space.Inventory.Items
iBrand = Items[1].Brand
Items = Space.Inventory.Items
iCustomData = Items[1].CustomData
ray=Space.Camera.ScreenCoordinatesToRay(Vector.New(0.5,0.5,0))
rayDirection = ray.Direction
  --this script will make this object jump to wherever you right click
--(Example: moving objects with right click )

thisGameObject = Space.Host.ExecutingObject


OnUpdate = function()
  if Space.Input.GetMouseDown(1) then
   clickRay = Space.Camera.ScreenCoordinatesToRay(Space.Input.MousePosition)
  rayCastHit = Space.Physics.RayCastSingle(clickRay.Origin, clickRay.Direction, 50.0)
  thisGameObject.WorldPosition = rayCastHit.Position
  end
end

thisGameObject.SubscribeToEvents()
thisGameObject.OnUpdate(OnUpdate)  

SGameObject get

SVector get

SVector get

SVector get

SVector get

float get

bool get

Properties

Object

SGameObject Object get

Property Description

this = Space.Host.ExecutingObject
hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)

hitGameObject = hit.Object

Position

SVector Position get

Where the physics hit occurred

Normal

SVector Normal get

The normal of the hit

UV

SVector UV get

The UV coordinates of where the hit occurred on a mesh.

This property will currently always return [0,0] due to a current bug.

UV2

SVector UV2 get

The UV2 coordinates of where the hit occurred on a mesh.

This property will currently always return [0,0] due to a current bug.

Distance

float Distance get

How far down a ray or from the collider, the hit occurred

ContainsHit

bool ContainsHit get

Whether it was a hit or not

override string ()

Properties Index

Property

string get set

string get set

string get set

string get set

string get set

string get set

string get set

string get set

string get set

Functions

ToString

override string ToString ()

Function Description

Parameter
Type
Description

Properties

Name

string Name get set

Property Description

Mt

string Mt get set

Property Description

Id

string Id get set

Property Description

Br

string Br get set

Property Description

Genre

string Genre get set

Property Description

Genre2

string Genre2 get set

Property Description

Logo

string Logo get set

Property Description

Ct

string Ct get set

Property Description

Lc

string Lc get set

Property Description

int get

int get

int get

int get

string get

SPublicRegion[] get

Properties

SubscriptionTier

int SubscriptionTier get

The subscription tier indicates which type of premium memberhsip the player has. (As found in "Region" window)

--Make's a UIText show this User's Regions' current Subscription Tier

textObject = Space.Host.GetReference("TheTextReference") --add to References section in Scripting Runtime

function GetUserRegionsComplete(SUserRegions)
  local r = SUserRegions.SubscriptionTier
  text.UIText.Text = r
end

NumberOfRegions

int NumberOfRegions get

The number of regions the player has. (As found in "Region" window)

UsersPerRegion

int UsersPerRegion get

The max number of users allowed per region. ("Concurrency" as found in "Region" window).

FileSize

int FileSize get

The maximum MB size the player's regions can be. ("Max Region SizE" in the "Region" window)

SubscriptionName

string SubscriptionName get

The name of the current player's premium subscription (as found in "Region" window)

AvailableRegions

SPublicRegion[] AvailableRegions get

Returns an array of SPublicRegion which is a group of data for each of the user's available regions.

string get

string get

string get

SGameObject get

SMaterial get

float get

float get

Properties

Name

string Name get

Returns the name of the resource as entered in the scripting runtime

ResourceName = Space.Resources[1].Name
--the below script will search through the Scripting Runtime's resources
--and return the first instance of an Animation Clip
--[You need to add a few resources to the scripting runtime and make one of them an animation]


resources = Space.Resources

for i = 1, #resources do
 if resources[i].Type == "AnimationClip" then

Type

string Type get

Returns the type of the resource as a string

AsText

string AsText get

Converts the resource's type from SResource type to string

AsGameObject

SGameObject AsGameObject get

Property Description

AsMaterial

SMaterial AsMaterial get

Converts the resource's type from SResource to SMaterial

TextureWidth

float TextureWidth get

Returns the Texture Width of this resource

TextureHeight

float TextureHeight get

Returns the Texture Height of this resource

void (Closure onLoad)

void (Closure onLoad, int parentId=0)

void (SGenre genre, Closure onLoad)

void (string search, Closure onLoad)

Functions

GetTop100

void GetTop100 (Closure onLoad)

Function Description

Parameter
Type
Description

example 1
example 2

GetGenreList

void GetGenreList (Closure onLoad, int parentId=0)

Function Description

Parameter
Type
Description

SearchByGenre

void SearchByGenre (SGenre genre, Closure onLoad)

Function Description

Parameter
Type
Description

SearchByText

void SearchByText (string search, Closure onLoad)

Function Description

Parameter
Type
Description

SJointSpring

Index

Functions Index

Function Name

SLayerMask

Index

Functions Index

Function
example 2
this = Space.Host.ExecutingObject
hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)

hitPosition = hit.Position
this = Space.Host.ExecutingObject
hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)

hitNormal = hit.Normal
this = Space.Host.ExecutingObject
hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)

hitUV = hit.UV
this = Space.Host.ExecutingObject
hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)

hitUV2 = hit.UV2
this = Space.Host.ExecutingObject
hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)

hitDistance = hit.Distance
this = Space.Host.ExecutingObject
hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)

hitContainsHit = hit.ContainsHit
example 1
example 2
example 1
example 2
example 1
example 2
example 1
example 2
example 1
example 2
example 1
example 2
example 1
example 2
example 1
example 2
example 1
example 2
example 1
example 2
--Make's a UIText show this User's Regions' current NumberOfRegions

textObject = Space.Host.GetReference("TheTextReference") --add to References section in Scripting Runtime

function GetUserRegionsComplete(SUserRegions)
  local r = SUserRegions.NumberOfRegions
  text.UIText.Text = r
end

Space.Grid.GetEnabledUserRegions(GetUserRegionsComplete)
--Make's a UIText show this User's Regions' current UsersPerRegion

textObject = Space.Host.GetReference("TheTextReference") --add to References section in Scripting Runtime

function GetUserRegionsComplete(SUserRegions)
  local r = SUserRegions.UsersPerRegion
  text.UIText.Text = r
end

Space.Grid.GetEnabledUserRegions(GetUserRegionsComplete)
--Make's a UIText show this User's Regions' current FileSize

textObject = Space.Host.GetReference("TheTextReference") --add to References section in Scripting Runtime

function GetUserRegionsComplete(SUserRegions)
  local r = SUserRegions.FileSize
  text.UIText.Text = r
end

Space.Grid.GetEnabledUserRegions(GetUserRegionsComplete)
--Make's a UIText show this User's Regions' current SubscriptionName

textObject = Space.Host.GetReference("TheTextReference") --add to References section in Scripting Runtime

function GetUserRegionsComplete(SUserRegions)
  local r = SUserRegions.SubscriptionName
  text.UIText.Text = r
end

Space.Grid.GetEnabledUserRegions(GetUserRegionsComplete)
--Make's a UIText show the Name of the user's first available region

textObject = Space.Host.GetReference("TheTextReference")

function GetUserRegionsComplete(SUserRegions)
  local r = SUserRegions.AvailableRegions[1]
  textObject.UIText.Text = r.Name
end

Space.Grid.GetEnabledUserRegions(GetUserRegionsComplete)
ResourceType = Space.GetResource("Resource Name").Type
--the below script will search through the Scripting Runtime's resources
--and return the first instance of an Animation Clip
--[You need to add a few resources to the scripting runtime and make one of them an animation]


resources = Space.Resources

for i = 1, #resources do
 if resources[i].Type == "AnimationClip" then
  Space.Log("Resource #".. i .. " is an Animation Clip. The resource name is: " .. resources[i].Name)
  break
 end
  end
Text = Space.GetResource("Resource Name").AsText
GameObject = Space.GetResource("Resource Name").AsGameObject
Material = Space.GetResource("Resource Name").AsMaterial
TextureWidth = Space.GetResource("Resource Name").TextureWidth
TextureHeight = Space.GetResource("Resource Name").TextureHeight
example 1
example 2
example 1
example 2
example 1
example 2
Object
Position
Normal
UV
UV2
Distance
ContainsHit
ToString
Name
Mt
Id
Br
Genre
Genre2
Logo
Ct
Lc
Space.Grid.GetEnabledUserRegions(GetUserRegionsComplete)
SubscriptionTier
NumberOfRegions
UsersPerRegion
FileSize
SubscriptionName
AvailableRegions
Space.Log("Resource #".. i .. " is an Animation Clip. The resource name is: " .. resources[i].Name)
break
end
end
Name
Type
AsText
AsGameObject
AsMaterial
TextureWidth
TextureHeight
GetTop100
GetGenreList
SearchByGenre
SearchByText

override string ()

static SJointSpring (float spring, float damper, float targetPosition)

Properties Index

Property Name

float get

float get

float get

Functions

ToString

override string ToString ()

Returns this SJointSpring's properties as a string

Parameter
Type
Description

SpringString = Space.Host.ExecutingObject.HingeJoint.Spring.ToString()

New

static SJointSpring New (float spring, float damper, float targetPosition)

Creates a new SJointSpring with the given spring, damper, targetPosition.

Parameter
Type
Description

Properties

Spring

float Springget

The spring forces used to reach the target position.

Damper

float Damperget

The damper force uses to dampen the spring.

TargetPosition

float TargetPositionget

The target position the joint attempts to reach.

void (params string[] layerNames) void (Table layerNames)

void (string layerName)

void (string layerName)

Static Functions

static SLayerMask (Table layerNames) static SLayerMask (params string[] layerNames)

Properties Index

Property
Description

bool get set

Is the mask exclusionary or not.

string[] get set

The layer names represented in this layer mask

Functions

SetLayers

void SetLayers (params string[] layerNames) void SetLayers (Table layerNames)

_Function that changes an existing layer mask _

Parameter
Type
Description

AddLayer

void AddLayer (string layerName)

Add a new layer to an existing layer mask.

Parameter
Type
Description

RemoveLayer

void RemoveLayer (string layerName)|

Remove a new layer from an existing layer mask.

Parameter
Type
Description

New

static SLayerMask New (Table layerNames) static SLayerMask New (params string[] layerNames)

Static function that creates a new layer mask

Parameter
Type
Description

Properties

Inverted

bool Inverted get set

Is the mask exclusionary or not.

Layers

string[] Layers get set

The layer names represented in this layer mask

SJointMotor

Index

Functions Index

Function Name

Properties Index

Property Name

Functions

ToString

override string ToString ()

Returns this SJointMotor's properties as a string

Parameter
Type
Description

New

static SJointMotor New (float targetVelocity, float force, bool freeSpin)

Creates a new SJointMotor with the given targetVelocity, force, freeSpin.

Parameter
Type
Description

Properties

TargetVelocity

float TargetVelocityget

The motor will apply a force up to force to achieve targetVelocity.

Force

float Forceget

The motor will apply a force.

FreeSpin

bool FreeSpinget

If freeSpin is enabled the motor will only accelerate but never slow down.

SUserProfile

Index

Properties Index

Property Name

Properties

UserName

string UserName get

Get player profile's Username

Title

string Title get

Get player profile's Title

RealName

string RealName get

Get player profile's Real Name

Gender

string Gender get

Get player profile's Gender

Since

string Since get

Get player profile's Since

Country

string Country get

Get player profile's Country

City

string City get

Get player profile's City

SocialGold

int SocialGold get

Get player profile's Gold Badge count

SocialSilver

int SocialSilver get

Get player profile's Silver Badge count

SocialFlower

int SocialFlower get

Get player profile's Flower count

Interests

string Interests get

Get player profile's Interests

About

string About get

Get player profile's About

SocialMediaProfiles

[] SocialMediaProfiles get

Get player profile's Social Media Profiles

SPublicRegion

Index

Properties Index

Property
--the below script will make a UI Text element display this GameObjects Hinge Joint Spring properties
--[Add "thetext" and "thehingejoint" reference to the Scripting Runtime component]
thisObject = Space.Host.ExecutingObject
text = Space.Host.GetReference("thetext").UIText
hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint


function OnUpdateFunction()
spring = hingejoint.Spring
text.Text = spring.ToString()
end


thisObject.OnUpdate(OnUpdateFunction)
Motor= Space.Host.ExecutingObject.HingeJoint.Spring.New(1,2,3)
--the below script will change all Hinge Joint Spring properties to 0 when clicked
--[Add "thehingejoint" reference to the Scripting Runtime component]
thisObject = Space.Host.ExecutingObject
hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint


function OnClickFunction() 
spring = hingejoint.Spring
hingejoint.Spring = spring .New(0,0,0)
end

thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClickFunction)
SpringSpring= Space.Host.ExecutingObject.HingeJoint.Spring.Spring
--the below script will make a slider change a Hinge Joint Spring Spring property
--[Add "theslider" and "thehingejoint" reference to the Scripting Runtime component]

slider = Space.Host.GetReference("theslider").UISlider
hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint


OVC = function()
spring = hingejoint.Spring
spring.Spring = (slider.Value * 10.0) -- from 0.0 to 10.0
hingejoint.Spring= spring
end

slider.OnValueChanged(OVC)
SpringDamper= Space.Host.ExecutingObject.HingeJoint.Spring.Damper
--the below script will make a slider change a Hinge Joint Spring Damper property
--[Add "theslider" and "thehingejoint" reference to the Scripting Runtime component]

slider = Space.Host.GetReference("theslider").UISlider
hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint


OVC = function()
spring = hingejoint.Spring
spring.Damper = (slider.Value * 10.0) -- from 0.0 to 10.0
hingejoint.Spring = spring
end

slider.OnValueChanged(OVC)
SpringTargetPosition = Space.Host.ExecutingObject.HingeJoint.Spring.TargetPosition
--the below script will make a slider change a Hinge Joint Spring TargetPosition property
--[Add "theslider" and "thehingejoint" reference to the Scripting Runtime component]

slider = Space.Host.GetReference("theslider").UISlider
hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint


OVC = function()
spring = hingejoint.Spring
spring.TargetPosition = (slider.Value * 10.0) -- from 0.0 to 10.0
hingejoint.Spring = spring
end

slider.OnValueChanged(OVC)
-- Let's create a new layer mask to filter out other avatars, then overwrite it to be vehicles instead:
local mask = LayerMask.New({"Avatars"});
mask.SetLayers({"Vehicles"});
local hit = Space.Physics.RaycastSingle(Space.Host.ExecutingObject.WorldPosition, Space.Host.ExecutingObject.Forward, 500.0, mask)
-- Let's create a new layer mask to filter out other avatars, then overwrite it to be vehicles instead:
local mask = LayerMask.New("Avatars");
mask.SetLayers("Vehicles");
local hit = Space.Physics.RaycastSingle(Space.Host.ExecutingObject.WorldPosition, Space.Host.ExecutingObject.Forward, 500.0, mask)
local mask = LayerMask.New("Avatars");
mask.AddLayer("Vehicles");
local hit = Space.Physics.RaycastSingle(Space.Host.ExecutingObject.WorldPosition, Space.Host.ExecutingObject.Forward, 500.0, mask)
local mask = LayerMask.New("Avatars");
mask.AddLayer("Vehicles");
local hit = Space.Physics.RaycastSingle(Space.Host.ExecutingObject.WorldPosition, Space.Host.ExecutingObject.Forward, 500.0, mask)
local mask = LayerMask.New("Avatars", "Vehicles", "UI");
mask.RemoveLayer("Vehicles");
local hit = Space.Physics.RaycastSingle(Space.Host.ExecutingObject.WorldPosition, Space.Host.ExecutingObject.Forward, 500.0, mask)
local mask = LayerMask.New("Avatars", "Vehicles", "UI");
mask.RemoveLayer("Vehicles");
local hit = Space.Physics.RaycastSingle(Space.Host.ExecutingObject.WorldPosition, Space.Host.ExecutingObject.Forward, 500.0, mask)
local mask = LayerMask.New({"Avatars", "Vehicles"});
local hit = Space.Physics.RaycastSingle(Space.Host.ExecutingObject.WorldPosition, Space.Host.ExecutingObject.Forward, 500.0, mask)
local mask = LayerMask.New("Avatars");
or
local mask = LayerMask.New("Avatars", "Vehicles", "UI");
local hit = Space.Physics.RaycastSingle(Space.Host.ExecutingObject.WorldPosition, Space.Host.ExecutingObject.Forward, 500.0, mask)
local mask = LayerMask.New("Avatars");
-- Now change it to be an exclusionary mask that gets everything EXCEPT Avatars.'

mask.inverted = true;
local mask = LayerMask.New("Avatars");
-- Get
local layers = mask.Layers;
-- Set
local layers = {"Vehicles", "UI"};

mask.Layers = layers;
ToString
New
Spring
Damper
TargetPosition
SetLayers
SetLayers
AddLayer
RemoveLayer
New
New
Inverted
Layers

override string ToString ()

static SJointMotor New (float targetVelocity, float force, bool freeSpin)

float TargetVelocity get

float Force get

bool FreeSpin get

MotorString = Space.Host.ExecutingObject.HingeJoint.Motor.ToString()
--the below script will make a UI Text element display this GameObjects Hinge Joint Motor properties
--[Add "thetext" and "thehingejoint" reference to the Scripting Runtime component]
thisObject = Space.Host.ExecutingObject
text = Space.Host.GetReference("thetext").UIText
hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint


function OnUpdateFunction()
motor = hingejoint.Motor
text.Text = motor.ToString()
end


thisObject.OnUpdate(OnUpdateFunction)
Motor= Space.Host.ExecutingObject.HingeJoint.Motor.New(1,2,true)
--the below script will change all Hinge Joint Motor properties to 0 when clicked
--[Add "thehingejoint" reference to the Scripting Runtime component]
thisObject = Space.Host.ExecutingObject
hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint


function OnClickFunction() 
motor = hingejoint.Motor
hingejoint.Motor = motor.New(0,0,false)
end

thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClickFunction)
MotorTargetVelocity = Space.Host.ExecutingObject.HingeJoint.Motor.TargetVelocity
--the below script will make a slider change a Hinge Joint Motor TargetVelocity property
--[Add "theslider" and "thehingejoint" reference to the Scripting Runtime component]

slider = Space.Host.GetReference("theslider").UISlider
hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint


OVC = function()
motor = hingejoint.Motor
motor.TargetVelocity = (slider.Value * 10.0) -- from 0.0 to 10.0
hingejoint.Motor = motor
end

slider.OnValueChanged(OVC)
MotorForce= Space.Host.ExecutingObject.HingeJoint.Motor.Force 
--the below script will make a slider change a Hinge Joint Motor Force property
--[Add "theslider" and "thehingejoint" reference to the Scripting Runtime component]

slider = Space.Host.GetReference("theslider").UISlider
hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint


OVC = function()
motor = hingejoint.Motor
motor.Force = (slider.Value * 10.0) -- from 0.0 to 10.0
hingejoint.Motor = motor
end

slider.OnValueChanged(OVC)
MotorFreeSpin = Space.Host.ExecutingObject.HingeJoint.Motor.FreeSpin
--the below script will toggle Hinge Joint Motor FreeSpin property 
--[Add "thehingejoint" reference to the Scripting Runtime component]

thisGameObject = Space.Host.ExecutingObject
hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint


function OnClickFunction()
motor = hingejoint.Motor
motor.FreeSpin = not motor.FreeSpin
hingejoint.Motor = motor
end

thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClickFunction)

SSocialMedia[] get

string UserName get

string Title get

string RealName get

string Gender get

string Since get

string Country get

string City get

int SocialGold get

int SocialSilver get

int SocialFlower get

string Interests get

SSocialMedia

string get

int get

int get

string get

string get

string get

int get

int get

int get

int get

SLandmark[] get

SSubRegion[] get

Properties

ID

int ID get

The Region ID of this region

OwnerID

int OwnerID get

The ID of the owner of this region

Name

string Name get

The Name of this region

MapPath

string MapPath get

Property Description

PreviewPath

string PreviewPath get

Property Description

RankingScore

int RankingScore get

The Ranking Score of the region.

MaxAvatars

int MaxAvatars get

The max number of avatars this region can hold.

FileSize

int FileSize get

The current MBs the region is using.

Memory

int Memory get

Property Description

Landmarks

SLandmark[] Landmarks get

An array of Landmarks in the region.

Regions

SSubRegion[] Regions get

Returns an array of SSubRegion in the region.

Description

string Description get

Returns the description of the region.

Access

int Access get

The access type of the region (such as "Public" or "Approved only") 1= Disabled, 2= FreeForall, 3= FriendsOnly, 4= ApprovedOnly, 5= GroupsOnly

SString

Index

Static Functions Index

Function Name

Static Functions

MD5

static string MD5 (string input)

Calculates the MD5Sum of input and returns the result as a hexadecimal string

Parameter
Type
Description

SHA1

static string SHA1 (string input)

Function Description

Parameter
Type
Description

Replace

static string Replace (string old, string pattern, string replace)

Function Description

Parameter
Type
Description

GenerateGUID

static string GenerateGUID ()

Function Description

Parameter
Type
Description

Base64Encode

static string Base64Encode (string input)

Converts input to Base64 and returns the result

Parameter
Type
Description

Base64Decode

static string Base64Decode (string input)

Converts input from Base64 and returns the result

Parameter
Type
Description

GetBytes

static byte[] GetBytes (string input)

Converts input to bytes using UTF8 encoding

Parameter
Type
Description

GetString

static string GetString (byte[] bytes)

Converts input to a UTF8 string

Parameter
Type
Description

EncodeURL

static string EncodeURL (string input)

Function Description

Parameter
Type
Description

DecodeURL

static string DecodeURL (string input)

Function Description

Parameter
Type
Description

RegexMatchResult

static string RegexMatchResult (string input, string pattern, string replacement)

Function Description

Parameter
Type
Description

SJointLimits

Index

Functions Index

Function Name

Properties Index

Property Name

Functions

ToString

override string ToString ()

Returns this SJointLimits's properties as a string

Parameter
Type
Description

New

static SJointLimits New (float min, float max, float bounciness, float bounceMinVelocity, float contactDistance)

Creates a new SJoinLimits with the given min, max, bounciness, bounceMinVelocity and contactDistance.

Parameter
Type
Description

Properties

Min

float Min get set

The lower angular limit (in degrees) of the joint.

Max

float Max get set

The upper angular limit (in degrees) of the joint.

Bounciness

float Bounciness get set

Determines the size of the bounce when the joint hits it's limit. Also known as restitution.

BounceMinVelocity

float BounceMinVelocity get set

The minimum impact velocity which will cause the joint to bounce.

ContactDistance

float ContactDistance get set

Distance inside the limit value at which the limit will be considered to be active by the solver.

SGroupInfo

Index

Properties Index

Property Name

SColor

Index

Functions Index

Function
userName = Space.Profile.ActivePlayerProfile.Username
userTitle = Space.Profile.ActivePlayerProfile.Title
userRealName = Space.Profile.ActivePlayerProfile.RealName
userGender = Space.Profile.ActivePlayerProfile.Gender
userSince = Space.Profile.ActivePlayerProfile.Since
userCountry = Space.Profile.ActivePlayerProfile.Country
userCity = Space.Profile.ActivePlayerProfile.City
userSocialGold = Space.Profile.ActivePlayerProfile.SocialGold
userSocialSilver = Space.Profile.ActivePlayerProfile.SocialSilver
userSocialFlower = Space.Profile.ActivePlayerProfile.SocialFlower
userInterests = Space.Profile.ActivePlayerProfile.Interests
userAbout = Space.Profile.ActivePlayerProfile.About
tableOfSSocialMedia = Space.Profile.ActivePlayerProfile.SocialMediaProfiles
function GetUserRegionsComplete(SUserRegions)
  local r = SUserRegions.AvailableRegions[1]
  regionID = r.ID
end

Space.Grid.GetEnabledUserRegions(GetUserRegionsComplete)
function GetUserRegionsComplete(SUserRegions)
  local r = SUserRegions.AvailableRegions[1]
  regionOwnerID = r.OwnerID
end

Space.Grid.GetEnabledUserRegions(GetUserRegionsComplete)
function GetUserRegionsComplete(SUserRegions)
  local r = SUserRegions.AvailableRegions[1]
  regionName = r.Name
end

Space.Grid.GetEnabledUserRegions(GetUserRegionsComplete)
function GetUserRegionsComplete(SUserRegions)
  local r = SUserRegions.AvailableRegions[1]
  regionMapPath = r.MapPath
end

Space.Grid.GetEnabledUserRegions(GetUserRegionsComplete)
--Make's a UIText show the Preview Path of the user's first available region

textObject = Space.Host.GetReference("TheTextReference")

function GetUserRegionsComplete(SUserRegions)
  local r = SUserRegions.AvailableRegions[1]
  regionPreviewPath = r.PreviewPath
end

Space.Grid.GetEnabledUserRegions(GetUserRegionsComplete)
function GetUserRegionsComplete(SUserRegions)
  local r = SUserRegions.AvailableRegions[1]
  regionRankingScore = r.RankingScore
end

Space.Grid.GetEnabledUserRegions(GetUserRegionsComplete)
function GetUserRegionsComplete(SUserRegions)
  local r = SUserRegions.AvailableRegions[1]
  regionMaxAvatars = r.MaxAvatars
end

Space.Grid.GetEnabledUserRegions(GetUserRegionsComplete)
function GetUserRegionsComplete(SUserRegions)
  local r = SUserRegions.AvailableRegions[1]
  regionFileSize = r.FileSize
end

Space.Grid.GetEnabledUserRegions(GetUserRegionsComplete)
function GetUserRegionsComplete(SUserRegions)
  local r = SUserRegions.AvailableRegions[1]
  regionMemory = r.Memory
end

Space.Grid.GetEnabledUserRegions(GetUserRegionsComplete)
function GetUserRegionsComplete(SUserRegions)
  local r = SUserRegions.AvailableRegions[1]
 regionLandmarks = r.Landmarks
end

Space.Grid.GetEnabledUserRegions(GetUserRegionsComplete)
function GetUserRegionsComplete(SUserRegions)
  local r = SUserRegions.AvailableRegions[1]
 regionSubRegions = r.Regions
end

Space.Grid.GetEnabledUserRegions(GetUserRegionsComplete)
function GetUserRegionsComplete(SUserRegions)
  local r = SUserRegions.AvailableRegions[1]
  regionDescription = r.Description
end

Space.Grid.GetEnabledUserRegions(GetUserRegionsComplete)
function GetUserRegionsComplete(SUserRegions)
  local r = SUserRegions.AvailableRegions[1]
  regionAccessType = r.Access
end

Space.Grid.GetEnabledUserRegions(GetUserRegionsComplete)
About
SocialMediaProfiles

string Description get

SAccessType Access get

ID
OwnerID
Name
MapPath
PreviewPath
RankingScore
MaxAvatars
FileSize
Memory
Landmarks
Regions

static string MD5 (string input)

static string SHA1 (string input)

static string Replace (string old, string pattern, string replace)

static string GenerateGUID ()

static string Base64Encode (string input) static string Base64Encode (byte[] input)

static string Base64Decode (string input)

static byte[] GetBytes (string input)

static string GetString (byte[] bytes)

static string EncodeURL (string input)

static string DecodeURL (string input)

static string RegexMatchResult (string input, string pattern, string replacement)

override string ToString ()

static SJointLimits New (float min, float max, float bounciness, float bounceMinVelocity, float contactDistance)

float Min get set

float Max get set

float Bounciness get set

float BounceMinVelocity get set

float ContactDistance get set

md5 = Space.String.MD5('AString')
sha1 = Space.String.SHA1('AString')
replaced = Space.String.Replace('AString', 'APattern', 'AReplace')
guid = Space.String.GenerateGUID()
baseEncodeByte = Space.String.Base64Encode{117, 116, 32, 116, 100, 101})
baseDecodedStr = Space.String.Base64Decode('aW5wdXQgdG8gZW5jb2Rl')
stringAsByteArray = Space.String.GetBytes('A String')
ByteArrayAsString = Space.String.GetString({115, 111, 109, 101, 32})
encodedURL = Space.String.EncodeURL('A String')
decodedURL = Space.String.DecodeURL('A String')
Space.Math.RegexMatchResult('astring', 'astring','astring')
LimitsString = Space.Host.ExecutingObject.HingeJoint.Limits.ToString()
--the below script will make a UI Text element display this GameObjects Hinge Joint Limits' properties
--[Add "thetext" and "thehingejoint" reference to the Scripting Runtime component]
thisObject = Space.Host.ExecutingObject
text = Space.Host.GetReference("thetext").UIText
hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint


function OnUpdateFunction()
limits = hingejoint.Limits
text.Text = limits.ToString()
end


thisObject.OnUpdate(OnUpdateFunction)
Limits = Space.Host.ExecutingObject.HingeJoint.Limits.New((1,2,3,4,5))
--the below script will change all Hinge Joint Limits properties to 0 when clicked
--[Add "thehingejoint" reference to the Scripting Runtime component]
thisObject = Space.Host.ExecutingObject
hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint


function OnClickFunction() 
limits = hingejoint.Limits
hingejoint.Limits = limits.New(0,0,0,0,0)
end

thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClickFunction)
LimitsMin = Space.Host.ExecutingObject.HingeJoint.Limits.Min
--the below script will make a slider change a Hinge Joint Limits Min property
--[Add "theslider" and "thehingejoint" reference to the Scripting Runtime component]

slider = Space.Host.GetReference("theslider").UISlider
hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint


OVC = function()
limits = hingejoint.Limits
limits.Min = (slider.Value * 10.0) -- from 0.0 to 10.0
hingejoint.Limits = limits
end

slider.OnValueChanged(OVC)
LimitsMax= Space.Host.ExecutingObject.HingeJoint.Limits.Max 
--the below script will make a slider change a Hinge Joint Limits Max property
--[Add "theslider" and "thehingejoint" reference to the Scripting Runtime component]

slider = Space.Host.GetReference("theslider").UISlider
hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint


OVC = function()
limits = hingejoint.Limits
limits.Max = (slider.Value * 10.0) -- from 0.0 to 10.0
hingejoint.Limits = limits
end

slider.OnValueChanged(OVC)
LimitsBounciness = Space.Host.ExecutingObject.HingeJoint.Limits.Bounciness 
--the below script will make a slider change a Hinge Joint Limits Bounciness property
--[Add "theslider" and "thehingejoint" reference to the Scripting Runtime component]

slider = Space.Host.GetReference("theslider").UISlider
hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint


OVC = function()
limits = hingejoint.Limits
limits.Bounciness = (slider.Value * 1.0) -- from 0.0 to 1.0
hingejoint.Limits = limits
end

slider.OnValueChanged(OVC)
 LimitsBounceMinVelocity = Space.Host.ExecutingObject.HingeJoint.Limits.BounceMinVelocity
--the below script will make a slider change a Hinge Joint Limits BounceMinVelocity property
--[Add "theslider" and "thehingejoint" reference to the Scripting Runtime component]

slider = Space.Host.GetReference("theslider").UISlider
hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint


OVC = function()
limits = hingejoint.Limits
limits.BounceMinVelocity = (slider.Value * 10.0) -- from 0.0 to 10.0
hingejoint.Limits = limits
end

slider.OnValueChanged(OVC)
LimitsContactDistance = Space.Host.ExecutingObject.HingeJoint.Limits.ContactDistance
--the below script will make a slider change a Hinge Joint Limits Contact Distance property
--[Add "theslider" and "thehingejoint" reference to the Scripting Runtime component]

slider = Space.Host.GetReference("theslider").UISlider
hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint


OVC = function()
limits = hingejoint.Limits
limits.ContactDistance = (slider.Value * 10.0) -- from 0.0 to 10.0
hingejoint.Limits = limits
end

slider.OnValueChanged(OVC)

int get

int get

string get

string get

string get

string get

int get

string get

string get

Properties

ID

int ID get

The ID of the group.

OwnerID

int OwnerID get

The ID of the group's owner.

Name

string Name get

The name of the group.

Description

string Description get

The description of the group.

Access

string Access get

The level of access the group has, e.g. public or private.

ImageUrl

string ImageUrl get

The URL of the group's image.

MaxAvatars

int MaxAvatars get

The max number of members the group can have.

Role

string Role get

Player's role in this group.

CreateDate

string CreateDate get

Creation date of the group.

string ()

SColor (SColor b, float t)

bool (SColor other)

override string ()

static SColor (float r, float g, float b, float a)

static SColor (string hex)

Properties Index

Property

float get

float get

float get

float get

SColor get

SColor get

SColor get

SColor get

SColor get

Functions

ToHex

string ToHex ()

Return the Hex value of the color.

Lerp

SColor Lerp (SColor b, float t)

Linearly interpolates between current color and b by t.

Parameter
Type
Description

Equals

bool Equals (SColor other)

Returns true if colors are same.

Parameter
Type
Description

ToString

string ToString ()

Returns the RGBA value of the current color.

New

static SColor New (float r, float g, float b, float a)

Create a color by red, green, blue and alpha parameters.

Parameter
Type
Description

FromHex

static SColor FromHex (string hex)

Create a color by Hex value.

Parameter
Type
Description

Properties

R

float R get

Property Description

G

float G get

Property Description

B

float B get

Property Description

A

float A get

Property Description

Black

SColor Black get

Solid black. RGBA is (0, 0, 0, 1).

White

SColor White get

Solid White. RGBA is (1, 1, 1, 1).

Red

SColor Red get

Solid Red. RGBA is (1, 0, 0, 1).

Blue

SColor Blue get

Solid Blue. RGBA is (0, 0, 1, 1).

Green

SColor Green get

Solid Green. RGBA is (0, 1, 0, 1).

Yellow

SColor Yellow get

Yellow. RGBA is (1, 0.92, 0.016, 1).

ID = Space.Groups.GetGroupInfo(350).ID
OwnerID = Space.Groups.GetGroupInfo(350).OwnerID
--Clicking this object will show canvas1 if you are a group's owner
--and will show canvas2 if you are not

thisObject = Space.Host.ExecutingObject

canvas1 = Space.Host.GetReference("canvas1")--Add this object with canvas as reference in Scripting Runtime
canvas2 = Space.Host.GetReference("canvas2")--Add this object with canvas as reference in Scripting Runtime


OnClickFunction = function()
  
local groupInfo = Space.Groups.GetGroupInfo(350)

  if groupInfo.OwnerID == Space.Scene.PlayerAvatar.ID then
    canvas1.Active = true
  else
    canvas2.Active = true
  end
  

end
Name = Space.Groups.GetGroupInfo(350).Name
--Clicking this object will show group 355's Name on a UIText object

thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime

OnClickFunction = function()
  
GroupInfo = Space.Groups.GetGroupInfo(350)

uiText.Text = GroupInfo.Name
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClickFunction)
Description =Space.Groups.GetGroupInfo(350).Description
--Clicking this object will show group 355's Description on a UIText object

thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime

OnClickFunction = function()
  
GroupInfo = Space.Groups.GetGroupInfo(350)

uiText.Text = GroupInfo.Description
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClickFunction)
Access = Space.Groups.GetGroupInfo(350).Access
--Clicking this object will show group 355's Access on a UIText object

thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime

OnClickFunction = function()
  
GroupInfo = Space.Groups.GetGroupInfo(350)

uiText.Text = GroupInfo.Access
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClickFunction)
ImageUrl = Space.Groups.GetGroupInfo(350).ImageUrl
--Clicking this object will show group 355's ImageUrl on a UIText object

thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime

OnClickFunction = function()
  
GroupInfo = Space.Groups.GetGroupInfo(350)

uiText.Text = GroupInfo.ImageUrl
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClickFunction)
MaxAvatars = Space.Groups.GetGroupInfo(350).MaxAvatars
--Clicking this object will show group 355's MaxAvatars on a UIText object

thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime

OnClickFunction = function()
  
GroupInfo = Space.Groups.GetGroupInfo(350)

uiText.Text = GroupInfo.MaxAvatars
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClickFunction)
Role = Space.Groups.GetGroupInfo(350).Role
--Clicking this object will show canvas1 if you are a  VIP in the group
--and will show canvas2 if you are a regular member
--and will show canvas3 if you are the group owner

thisObject = Space.Host.ExecutingObject

canvas1 = Space.Host.GetReference("canvas1")--Add this object with canvas as reference in Scripting Runtime
canvas2 = Space.Host.GetReference("canvas2")--Add this object with canvas as reference in Scripting Runtime
canvas3 = Space.Host.GetReference("canvas3")--Add this object with canvas as reference in Scripting Runtime

OnClickFunction = function()
  
local groupInfo = Space.Groups.GetGroupInfo(350)

  if groupInfo.Role == "Owner" then
  canvas3.Active = true
  elseif groupInfo.Role == "VIP" then
  canvas1.Active = true
  elseif groupInfo.Role == "Normal" then
  canvas2.Active = true
  end

end
CreateDate = Space.Groups.GetGroupInfo(350).CreateDate
--Clicking this object will show group 355's creation date on a UIText object

thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime

OnClickFunction = function()
  
CreateDate = Space.Groups.GetGroupInfo(350).CreateDate

uiText.Text = CreateDate
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClickFunction)
colorRedHex = Color.Red.ToHex()
lerpedRedBlue = Color.Blue.Lerp(Color.Red, 0.5)
--create a cube and set a new material.
--add ScriptingRuntime.
local mat=Space.Host.ExecutingObject.Renderer.Material
function ChangeColor()
    mat.SetColor("_Color",Color.Red.Lerp(Color.Blue,Space.Math.PingPong(Space.Time,1)))
end
Space.Host.ExecutingObject.OnUpdate(ChangeColor)
isItTrue = Color.Red.Equals(Color.Blue)
redString = Color.Red.ToString()
theColor = Color.New(255.0, 0.0, 0.0, 1.0)
fromHex = Color.FromHex('FF0000')
r = Color.Red.R
g = Color.Red.G
g = Color.Red.B
g = Color.Red.A
blackColor = Color.Black
whiteColor = Color.White
blackRed = Color.Red
blueColor = Color.Blue
greenColor = Color.Green
yellowColor = Color.Yellow
ID
OwnerID
Name
Description
Access
ImageUrl
MaxAvatars
Role
CreateDate

SColor Yellow get

ToHex
Lerp
Equals
ToString
New
FromHex
R
G
B
A
Black
White
Red
Blue
Green

SAvatarAppearance

Index

Functions Index

Function Name

Properties Index

Property Name

Functions

LoadOutfit

void LoadOutfit (int outfitID)

Changes the current Avatar's outfit to outfitID. For a player Avatar, this only works on white-label grid. For NPC avatars, this works on all grids.

Parameter
Type
Description

ResetOutfit

void ResetOutfit ()

Changes the current Avatar's outfit and resets it to outfitID 0. For a player Avatar, this only works on white-label grid. For NPC avatars, this works on all grids.

ResetOutfitToTemplate

void ResetOutfitToTemplate (int outfitID)

Changes the current Avatar's outfit to outfitID only if the player running this code already owns that outfit. For a player Avatar, this only works on white-label grid. For NPC avatars, this works on all grids.

Parameter
Type
Description

GetSlider

float GetSlider (int slider)

Return the value of Appearance Sliders.

Parameter
Type
Description

GetHeight

float GetHeight ()

Return height of avatar.

GetSkinTone

GetSkinTone ()

Return skin tone of avatar.

GetEyeTone

GetEyeTone ()

Return eye tone of avatar.

Properties

OutfitID

long OutfitID get

Return the current outfit id.

Skeleton

Skeleton get

Return the GameObject of avatar skeleton.

Loaded

bool Loaded get

Returns true if the avatar is full loaded.

GameObject

GameObject get

Property Description

SParticle

Index

Properties Index

Property

Properties

position

position get set

The position of the particle.

velocity

velocity get set

The velocity of the particle.

animatedVelocity

animatedVelocity get

The animated velocity of the particle.

totalVelocity

totalVelocity get

The total velocity of the particle.

remainingLifetime

float remainingLifetime get set

The remaining lifetime of the particle.

startLifetime

float startLifetime get set

The starting lifetime of the particle.

startColor

startColor get set

The initial color of the particle. The current color of the particle is calculated procedurally based on this value and the active color modules.

randomSeed

uint randomSeed get set

The random seed of the particle.

axisOfRotation

axisOfRotation get set

Mesh particles rotate around this axis.

startSize

float startSize get set

The initial size of the particle. The current size of the particle is calculated procedurally based on this value and the active size modules.

startSize3D

startSize3D get set

The initial 3D size of the particle. The current size of the particle is calculated procedurally based on this value and the active size modules.

rotation

float rotation get set

The rotation of the particle.

rotation3D

rotation3D get set

The 3D rotation of the particle.

this = Space.Host.ExecutingObject

OnParticleTrigger = function(GameObject) ParticlesArray = this.ParticleSystem.GetTriggerParticles(0) FirstParticle = ParticlesArray[1] rotation3D= FirstParticle.rotation3D

end

this.SubscribeToEvents() this.OnParticleTrigger(OnParticleTrigger)

angularVelocity

float angularVelocity get set

The angular velocity of the particle.

angularVelocity3D

angularVelocity3D get set

The 3D angular velocity of the particle.

void LoadOutfit (int outfitID)

void ResetOutfit ()

void ResetOutfitToTemplate (int outfitID)

float GetSlider (SAppearanceSlider slider)

float GetHeight ()

SColor GetSkinTone ()

SColor GetEyeTone ()

long OutfitID get

SGameObject Skeleton get

bool Loaded get

SGameObject GameObject get

slider

int

1= Asian, 2= European, 3= African, 4= FaceShape, 5= FaceWidth, 6= FaceLength, 7= ForeheadShape, 8= ForeheadDepth, 9= CheekHeight, 10= CheekWidth, 11= JawShape, 12= JawWidth, 13= JawHeight, 14= EyebrowHeight, 15= EyebrowDepth, 16= EyeHeight, 17= EyeSpacing, 18= EyeSize, 19= EyeWidth, 20= EyeballSize, 21= EyeInside, 22= EyeOutside, 23= EyelashLength, 24= NoseWidth, 25= NoseDepth, 26= NoseHeight, 27= NoseShape, 28= NoseTipShape, 29= NostrilWidth, 30= MouthWidth, 31= MouthHeight, 32= MouthDepth, 33= UpperLipWidth, 34= UpperLipThickness, 35= LowerLipWidth, 36= LowerLipThickness, 37= Smile, 38= EarHeight, 39= EarWidth, 40= Earlobe, 41= EarShape, 42= Muscular, 43= Toned, 44= Grand, 45= Lean, 46= SkullHeight, 47= SkullWidth, 48= SkullDepth, 49= NeckThickness, 50= ShoulderThickness, 51= UpperArmThickness, 52= ForearmThickness, 53= WristSize, 54= ElbowThin, 55= HandThickness, 56= HandTone, 57= FingerWidth, 58= BustProximity, 59= BustSize, 60= ChestDepth, 61= PectoralSize, 62= PectoralHeight, 63= AbdomenMiddle, 64= AbdomenDepth, 65= WaistWidth, 66= HipSize, 67= GlutesSize, 68= GlutesHeight, 69= LoveHandles, 70= ThighSize, 71= KneeTone, 72= ShinSize, 73= AnkleTone, 74= FootThickness, 75= FootTone, 76= ToeWidth, 77= HeadSize, 78= NeckSize, 79= ShoulderSize, 80= UpperArmSize, 81= ForearmSize, 82= HandSize, 83= SpineSize, 84= ChestSize, 85= UpperLegSize, 86= LowerLegSize, 87= FeetSize, 88= ToesSize, 89= HeadPosition, 90= NeckLength, 91= ForearmLength, 92= HandPosition, 93= SpineLength, 94= ChestLength, 95= UpperLegLength, 96= LowerLegLength, 97= FeetLength, 98= ToesLength, 99= ShoulderHeight, 100= ShoulderWidth, 101= FeetFloorOffset

SColor
SColor
SGameObject
SGameObject
Space.Host.ExecutingObject.AvatarAppearance.LoadOutfit(160)
--this script toggles between 3 different outfits when NPC Statue object is clicked
--[Object needs to have an NPC Statue component]

outfits = {4134388, 4134385, 4134386}
currentOutfit = 0
thisObject = Space.Host.ExecutingObject


function OnClickFunction()
  if currentOutfit == #outfits then
  currentOutfit = 1
  else
  currentOutfit = currentOutfit + 1
  end

thisObject.AvatarAppearance.LoadOutfit(outfits[currentOutfit])
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClickFunction)
Space.Host.ExecutingObject.AvatarAppearance.ResetOutfit()
--this script makes a UIButton reset an NPC statue outfit when clicked
--[UIButton object needs to be linked in scripting runtime references with name "button1"]
--[Object needs to have an NPC Statue component]

thisObject = Space.Host.ExecutingObject
refButton = Space.Host.GetReference("button1")

function OnClickFunction()
thisObject.AvatarAppearance.ResetOutfit()
end


refButton.UIButton.OnClick(OnClickFunction)
Space.Host.ExecutingObject.AvatarAppearance.ResetOutfitToTemplate(10001)
--this script toggles between 3 different outfits when NPC Statue object is clicked
--[Object needs to have an NPC Statue component]
--For this function, the player needs to own this outfit. Use LoadOutfit if player might not own it

outfits = {4134388, 4134385, 4134386}
currentOutfit = 0
thisObject = Space.Host.ExecutingObject


function OnClickFunction()
  if currentOutfit == #outfits then
  currentOutfit = 1
  else
  currentOutfit = currentOutfit + 1
  end

thisObject.AvatarAppearance.ResetOutfitToTemplate(outfits[currentOutfit])
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClickFunction)
FaceLength = Space.Host.ExecutingObject.AvatarAppearance.GetSlider(AppearanceSlider.FaceLength)
--this script updates a UIText with the current Face Length of the npc

thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("thetext").UIText --Add this object with UIText component as reference in Scripting Runtime

OnUpdateFunction = function()
uiText.Text = thisObject.AvatarAppearance.GetSlider(AppearanceSlider.FaceLength)
end


thisObject.OnUpdate(OnUpdateFunction)
height = Space.Host.ExecutingObject.AvatarAppearance.GetHeight()
--this script updates a UIText with the height of this NPC statue

thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("thetext").UIText --Add this object with UIText component as reference in Scripting Runtime

OnUpdateFunction = function()
uiText.Text = thisObject.AvatarAppearance.GetHeight()
end


thisObject.OnUpdate(OnUpdateFunction)
SkinTone = Space.Host.ExecutingObject.AvatarAppearance.GetSkinTone()
--this script updates a UIText with the current Skin Tone of the npc

thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("thetext").UIText --Add this object with UIText component as reference in Scripting Runtime

OnUpdateFunction = function()
uiText.Text = thisObject.AvatarAppearance.GetSkinTone().ToString()
end


thisObject.OnUpdate(OnUpdateFunction)
 EyeTone = Space.Host.ExecutingObject.AvatarAppearance.GetEyeTone()
--this script updates a UIText with the current Eye Tone of the npc

thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("thetext").UIText --Add this object with UIText component as reference in Scripting Runtime

OnUpdateFunction = function()
uiText.Text = thisObject.AvatarAppearance.GetEyeTone().ToString()
end


thisObject.OnUpdate(OnUpdateFunction)
outfitID= Space.Host.ExecutingObject.AvatarAppearance.OutfitID
--this script updates a UIText with the current outfit ID of the npc

thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("thetext").UIText --Add this object with UIText component as reference in Scripting Runtime

OnUpdateFunction = function()
uiText.Text = thisObject.GameObject.AvatarAppearance.OutfitID
end


thisObject.OnUpdate(OnUpdateFunction)
playerSkeleton = Space.Host.ExecutingObject.AvatarAppearance.Skeleton
isLoaded= Space.Host.ExecutingObject.AvatarAppearance.Loaded
--this script updates a UIText with the loading status of the npc

thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("thetext").UIText --Add this object with UIText component as reference in Scripting Runtime

OnUpdateFunction = function()
uiText.Text = thisObject.AvatarAppearance.Loaded
end


thisObject.OnUpdate(OnUpdateFunction)
 npcGameObject = Space.Host.ExecutingObject.AvatarAppearance.GameObject

SVector get set

float get set

SVector get set

SVector position get set

SVector velocity get set

SVector animatedVelocity get

SVector totalVelocity get

float remainingLifetime get set

float startLifetime get set

SColor startColor get set

uint randomSeed get set

SVector axisOfRotation get set

float startSize get set

SVector startSize3D get set

SVector
SVector
SVector
SVector
SColor
SVector
SVector
SVector
SVector

float get set

SUIRaycastResult

Index

Functions Index

Function

Properties Index

Property

Functions

Clear

void Clear ()

Reset all the parameters of this RaycastResult

Parameter
Type
Description

ToString

string ToString ()

Converts all the properties of this UIRaycastResult into a string

Parameter
Type
Description

Properties

Distance

float Distance get

Returns the distance of the Raycast result

Index

float Index get

Returns the Index of the Raycast result

Depth

int Depth get

Returns the Depth of the Raycast result

SortingLayer

int SortingLayer get

Returns the Sorting Layer of the Raycast result

SortingOrder

int SortingOrder get

Returns the Sorting Order of the Raycast result

WorldPosition

WorldPosition get

Returns the World Position vector of the Raycast result

WorldNormal

WorldNormal get

Returns the World Normal vector of the Raycast result

ScreenPosition

ScreenPosition get

Returns the Screen Position vector of the Raycast result

GameObject

GameObject get

Returns a reference to the GameObject of the Raycast result

IsValid

bool IsValid get

Returns whether the Raycast hit a valid UI Raycast target. This will be true if the Raycast hits an element on Sinespace's UI

SMaterial

Index

Functions Index

Function
this = Space.Host.ExecutingObject

OnParticleTrigger = function(GameObject)
 ParticlesArray  = this.ParticleSystem.GetTriggerParticles(0)
 FirstParticle = ParticlesArray[1]
 position = FirstParticle.position
 
end

this.SubscribeToEvents()
this.OnParticleTrigger(OnParticleTrigger)
example 2
this = Space.Host.ExecutingObject

OnParticleTrigger = function(GameObject)
 ParticlesArray  = this.ParticleSystem.GetTriggerParticles(0)
 FirstParticle = ParticlesArray[1]
 velocity= FirstParticle.velocity
 
end

this.SubscribeToEvents()
this.OnParticleTrigger(OnParticleTrigger)
this = Space.Host.ExecutingObject

OnParticleTrigger = function(GameObject)
 ParticlesArray  = this.ParticleSystem.GetTriggerParticles(0)
 FirstParticle = ParticlesArray[1]
 animatedVelocity= FirstParticle.animatedVelocity
 
end

this.SubscribeToEvents()
this.OnParticleTrigger(OnParticleTrigger)
example 2
this = Space.Host.ExecutingObject

OnParticleTrigger = function(GameObject)
 ParticlesArray  = this.ParticleSystem.GetTriggerParticles(0)
 FirstParticle = ParticlesArray[1]
 totalVelocity= FirstParticle.totalVelocity
 
end

this.SubscribeToEvents()
this.OnParticleTrigger(OnParticleTrigger)
this = Space.Host.ExecutingObject

OnParticleTrigger = function(GameObject)
 ParticlesArray  = this.ParticleSystem.GetTriggerParticles(0)
 FirstParticle = ParticlesArray[1]
 remainingLifetime= FirstParticle.remainingLifetime
 
end

this.SubscribeToEvents()
this.OnParticleTrigger(OnParticleTrigger)
this = Space.Host.ExecutingObject

OnParticleTrigger = function(GameObject)
 ParticlesArray  = this.ParticleSystem.GetTriggerParticles(0)
 FirstParticle = ParticlesArray[1]
 startLifetime= FirstParticle.startLifetime
 
end

this.SubscribeToEvents()
this.OnParticleTrigger(OnParticleTrigger)
this = Space.Host.ExecutingObject

OnParticleTrigger = function(GameObject)
 ParticlesArray  = this.ParticleSystem.GetTriggerParticles(0)
 FirstParticle = ParticlesArray[1]
 startColor= FirstParticle.startColor
 
end

this.SubscribeToEvents()
this.OnParticleTrigger(OnParticleTrigger)
this = Space.Host.ExecutingObject

OnParticleTrigger = function(GameObject)
 ParticlesArray  = this.ParticleSystem.GetTriggerParticles(0)
 FirstParticle = ParticlesArray[1]
 randomSeed= FirstParticle.randomSeed
 
end

this.SubscribeToEvents()
this.OnParticleTrigger(OnParticleTrigger)
this = Space.Host.ExecutingObject

OnParticleTrigger = function(GameObject)
 ParticlesArray  = this.ParticleSystem.GetTriggerParticles(0)
 FirstParticle = ParticlesArray[1]
 axisOfRotation= FirstParticle.axisOfRotation
 
end

this.SubscribeToEvents()
this.OnParticleTrigger(OnParticleTrigger)
this = Space.Host.ExecutingObject

OnParticleTrigger = function(GameObject)
 ParticlesArray  = this.ParticleSystem.GetTriggerParticles(0)
 FirstParticle = ParticlesArray[1]
 startSize= FirstParticle.startSize
 
end

this.OnParticleTrigger(OnParticleTrigger)
this = Space.Host.ExecutingObject

OnParticleTrigger = function(GameObject)
 ParticlesArray  = this.ParticleSystem.GetTriggerParticles(0)
 FirstParticle = ParticlesArray[1]
 startSize3D= FirstParticle.startSize3D
 
end

this.OnParticleTrigger(OnParticleTrigger)
this = Space.Host.ExecutingObject

OnParticleTrigger = function(GameObject)
 ParticlesArray  = this.ParticleSystem.GetTriggerParticles(0)
 FirstParticle = ParticlesArray[1]
 rotation= FirstParticle.rotation
 
end

this.OnParticleTrigger(OnParticleTrigger)
</div>

</div>

<div data-gb-custom-block data-tag="tabs">

<div data-gb-custom-block data-tag="tab" data-title='Lua'>

```lua
example 2
this = Space.Host.ExecutingObject

OnParticleTrigger = function(GameObject)
 ParticlesArray  = this.ParticleSystem.GetTriggerParticles(0)
 FirstParticle = ParticlesArray[1]
 angularVelocity= FirstParticle.angularVelocity
 
end

this.SubscribeToEvents()
this.OnParticleTrigger(OnParticleTrigger)
this = Space.Host.ExecutingObject

OnParticleTrigger = function(GameObject)
 ParticlesArray  = this.ParticleSystem.GetTriggerParticles(0)
 FirstParticle = ParticlesArray[1]
 angularVelocity3D= FirstParticle.angularVelocity3D
 
end

this.SubscribeToEvents()
this.OnParticleTrigger(OnParticleTrigger)
rotation
rotation3D
angularVelocity
angularVelocity3D

SMaterial Instantiate()

void (string key, float value)

float (string key)

void (string key, SColor color) void (string key, float r, float g, float b, float a)

(string key)

void (string key, byte r, byte g, byte b, byte a)

void (string key, int value)

int (string key)

void (string key, SResource value)

SResource (string key)

void (string key, float x, float y)

Properties Index

Property
Description

string get set

string get

int get set

Functions

Instantiate

SMaterial Instantiate()

Return a new SMaterial from old.

Parameter
Type
Description

SetFloat

void SetFloat (string key, float value)

Sets a shader property to value

Parameter
Type
Description

GetFloat

float GetFloat (string key)

Gets the current value of a shader property.

Parameter
Type
Description

SetColor

void SetColor (string key, SColor color) void SetColor (string key, float r, float g, float b, float a)

Sets a shader colour

Parameter
Type
Description

GetColor

SColor GetColor (string propertyName)

Get a named color value. Many shaders use more than one color. Use GetColor to get the propertyName color.

Parameter
Type
Description

propertyName

string

Common color names used by Unity's builtin shaders: "_Color" is the main color of a material.

"_SpecColor" is the specular color of a material (used in specular/glossy/vertexlit shaders).

"_EmissionColor" is the emissive color of a material (used in vertexlit shaders). "_ReflectColor" is the reflection color of the material (used in reflective shaders).

SetColor32

void SetColor32 (string key, byte r, byte g, byte b, byte a)

Sets a shader colour to value (32-bit, 0..255 values)

Parameter
Type
Description

SetInt

void SetInt (string key, int value)

Sets a shader property to value. This can be a convenient way to work with Boolean values.

Parameter
Type
Description

GetInt

int GetInt (string key)

Gets the current value of a shader property. This can be a convenient way to work with Boolean values.

Parameter
Type
Description

SetTexture

void SetTexture (string key, SResource value)

Sets a object's specified texture map (specified in parameter 1) to the texture provided as a resource in parameter #2. The example script must be in a object with a '_MainTex' map, and that object should be set as a resource on the scripting runtime. Additionally, that object should be called 'dispobj'.

note also that this function can be used to set any of the texture maps by varying the value of the first parameter accordingly.

Parameter
Type
Description

GetTexture

SResource GetTexture (string propertyName)

Get a named texture. Many shaders use more than one texture. Use GetTexture to get the propertyName texture.

Parameter
Type
Description

propertyName

string

Common texture names used by Unity's builtin shaders:

"_MainTex" is the main diffuse texture.

"_BumpMap" is the normal map. "_Cube" is the reflection cubemap.

SetTextureOffset

void SetTextureOffset (string key, float x, float y)

Sets a texture offset to a value.

Parameter
Type
Description

SetTextureScale

void SetTextureScale (string key, float x, float y)

Sets a texture scale to a value.

Parameter
Type
Description

SetVector

void SetVector (string key, SVector value)

Sets a shader property to value

Parameter
Type
Description

Properties

Name

string Name get set

Return a new SMaterial from old.

Shader

string Shader get

Return the shader name of current SMaterial.

RenderQueue

int RenderQueue get set

Render queue of this material.

By default materials use render queue of the shader it uses. You can override the render queue used using this variable. Note that if a shader on the material is changed, the render queue resets to that of the shader itself.

Render queue value should be in [0..5000] range to work properly; or -1 to use the render queue from the shader.

void Clear ()

string ToString ()

float Distance get

float Index get

int Depth get

int SortingLayer get

int SortingOrder get

SVector WorldPosition get

SVector WorldNormal get

SVector ScreenPosition get

SGameObject GameObject get

SVector
SVector
SVector
SGameObject

bool get

local cube=Space.Host.ExecutingObject
local cube2=cube.Children[1]
local mat1=cube.Renderer.Material
local newMat=mat1.Instantiate() newMat.SetColor("_Color",Color.Red) cube2.Renderer.Material=newMat

--at this moment, cube2 will turn to red but cube will keep original color.
-- Let's set the Metallic property to 0.75:
local obj = Space.Host.ExecutingObject;
obj.Renderer.Material.SetFloat("_Metallic", 0.75);
-- Let's find out the current Glosiness level
local obj = Space.Host.ExecutingObject;
Space.Log(obj.Renderer.Material.GetFloat("_Glossiness"));
-- prints "0.5" (by default) to the console.
-- Let's change the Color to red:
local obj = Space.Host.ExecutingObject;
local newColor = Color.New(1, 0, 0, 1);
obj.Renderer.Material.SetColor("_Color", newColor);
-- Let's change the Color to purple:
local obj = Space.Host.ExecutingObject;
obj.Renderer.Material.SetColor("_Color", 0.5,0,0.5,1);
Space.Host.ExecutingObject.Renderer.Material.GetColor("_Color")
-- Let's change the Color to light blue:
local obj = Space.Host.ExecutingObject;
obj.Renderer.Material.SetColor32("_Color", 53,172,232,255);
-- For example, let's disable Specular Highlights (enabled by default in the Standard shader):
local obj = Space.Host.ExecutingObject;
obj.Renderer.Material.SetInt("_SpecularHighlights", 0);
-- Let's find out if the Reflections property is enabled:
local obj = Space.Host.ExecutingObject;
Space.Log(obj.Renderer.Material.GetInt("_GlossyReflections"));
-- prints "1" (by default) to the console, which means that the Reflections property is indeed enabled.
function hithere()
  image = "mrlee.jpg"

  server = "https://middleware.systems/"

  obj = Space.Host.GetReference("dispobj")

  resrc = Space.WebServices.GetImage(server .. image)

  obj.Renderer.Material.SetTexture("_MainTex", resrc)

end
textureResource = Space.Host.ExecutingObject.Renderer.Material.GetTexture("_MainTex")
Space.Host.ExecutingObject.Renderer.Material.SetTextureOffset("_MainTex", 0, 1)
Space.Host.ExecutingObject.Renderer.Material.SetTextureScale("_MainTex", 0, 1)
Space.Host.ExecutingObject.Renderer.Material.SetTexture("_APropertyName", Vector.New(0,1,0))
local cube=Space.Host.ExecutingObject
local mat=cube.Renderer.Material
Space.Log(mat.Name)
local cube=Space.Host.ExecutingObject
local mat=cube.Renderer.Material
Space.Log(mat.Shader)
RenderQueue = Space.Host.ExecutingObject.Renderer.Material.RenderQueue
Result = Space.UI.Raycast()
Result.Clear()
Result = Space.UI.Raycast().ToString()
--This script will update a UIText element with the result of a UIRaycast whenever...
--the player clicks on a Sinespace UI element
thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime



OnUpdate = function()

  if Space.Input.GetMouseDown(0) == true then
  result = Space.UI.Raycast()	
    if result.IsValid then 
      uiText = result.ToString()
    end
  end
end


thisObject.OnUpdate(OnUpdate)
Result = Distance = Space.UI.Raycast().Distance
--This script will update a UIText element with the Distance of the UIRaycast whenever
--the player clicks on a Sinespace UI element
thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime


OnUpdate = function()
  if Space.Input.GetMouseDown(0) == true then
  result = Space.UI.Raycast()	
    if result.IsValid then 
      uiText = result.Distance
    end
  end
end

thisObject.OnUpdate(OnUpdate)
Index= Space.UI.Raycast().Index
--This script will update a UIText element with the Index of the UIRaycast whenever
--the player clicks on a Sinespace UI element
thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime


OnUpdate = function()
  if Space.Input.GetMouseDown(0) == true then
  result = Space.UI.Raycast()	
    if result.IsValid then 
      uiText = result.Index
    end
  end
end

thisObject.OnUpdate(OnUpdate)
Depth= Space.UI.Raycast().Depth
--This script will update a UIText element with the Depth of the UIRaycast whenever
--the player clicks on a Sinespace UI element
thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime


OnUpdate = function()
  if Space.Input.GetMouseDown(0) == true then
  result = Space.UI.Raycast()	
    if result.IsValid then 
      uiText = result.Depth
    end
  end
end

thisObject.OnUpdate(OnUpdate)
SortingLayer= Space.UI.Raycast().SortingLayer
--This script will update a UIText element with the Sorting Layer of the UIRaycast whenever
--the player clicks on a Sinespace UI element
thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime


OnUpdate = function()
  if Space.Input.GetMouseDown(0) == true then
  result = Space.UI.Raycast()	
    if result.IsValid then 
      uiText = result.SortingLayer
    end
  end
end

thisObject.OnUpdate(OnUpdate)
SortingOrder= Space.UI.Raycast().SortingOrder
--This script will update a UIText element with the Sorting Order of the UIRaycast whenever
--the player clicks on a Sinespace UI element
thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime


OnUpdate = function()
  if Space.Input.GetMouseDown(0) == true then
  result = Space.UI.Raycast()	
    if result.IsValid then 
      uiText = result.SortingOrder
    end
  end
end

thisObject.OnUpdate(OnUpdate)
WorldPosition= Space.UI.Raycast().WorldPosition
--This script will update a UIText element with the World Position of the UIRaycast whenever
--the player clicks on a Sinespace UI element
thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime


OnUpdate = function()
  if Space.Input.GetMouseDown(0) == true then
  result = Space.UI.Raycast()	
    if result.IsValid then 
      uiText = result.WorldPosition
    end
  end
end

thisObject.OnUpdate(OnUpdate)
WorldNormal= Space.UI.Raycast().WorldNormal
--This script will update a UIText element with the World Normal of the UIRaycast whenever
--the player clicks on a Sinespace UI element
thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime


OnUpdate = function()
  if Space.Input.GetMouseDown(0) == true then
  result = Space.UI.Raycast()	
    if result.IsValid then 
      uiText = result.WorldNormal
    end
  end
end

thisObject.OnUpdate(OnUpdate)
ScreenPosition= Space.UI.Raycast().ScreenPosition
--This script will update a UIText element with the Screen Position of the UIRaycast whenever
--the player clicks on a Sinespace UI element
thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime


OnUpdate = function()
  if Space.Input.GetMouseDown(0) == true then
  result = Space.UI.Raycast()	
    if result.IsValid then 
      uiText = result.ScreenPosition
    end
  end
end

thisObject.OnUpdate(OnUpdate)
GameObject= Space.UI.Raycast().GameObject
--This script will update a UIText element with the name of the UIRaycast 
--by accesing it's GameObject whenever the player clicks on a Sinespace UI element
thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime


OnUpdate = function()
  if Space.Input.GetMouseDown(0) == true then
  result = Space.UI.Raycast()	
    if result.IsValid then 
      uiText = result.GameObject.Name
    end
  end
end

thisObject.OnUpdate(OnUpdate)
IsValid= Space.UI.Raycast().IsValid
--This script will check if Raycast result is valid
--and update a UIText element with the result of a UIRaycast whenever
--the player clicks on a Sinespace UI element
thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime



OnUpdate = function()

  if Space.Input.GetMouseDown(0) == true then
  result = Space.UI.Raycast()	
    if result.IsValid then 
      uiText = result.ToString()
    end
  end
end


thisObject.OnUpdate(OnUpdate)
IsValid

void SetTextureScale (string key, float x, float y)

void SetVector (string key, SVector value)

SetFloat
GetFloat
SetColor
SetColor
SColor
GetColor
SetColor32
SetInt
GetInt
SetTexture
GetTexture
SetTextureOffset
Name
Shader
RenderQueue

SRect

Index

Functions Index

Function

Properties Index

Property

Functions

Contains

bool Contains ( point) bool Contains ( point, bool allowInverse)

Returns true if the x and y components of point is a point inside this rectangle. If allowInverse is present and true, the width and height of the Rect are allowed to take negative values (ie, the min value is greater than the max), and the test will still work.

Parameter
Type
Description

Overlaps

bool Overlaps (SRect other) bool Overlaps (SRect other, bool allowInverse)

Returns true if the other rectangle overlaps this one. If allowInverse is present and true, the widths and heights of the Rects are allowed to take negative values (ie, the min value is greater than the max), and the test will still work.

Parameter
Type
Description

Equals

bool Equals (SRect other)

Returns true if the rectangles are the same.

Parameter
Type
Description

ToString

string ToString (string format) string ToString ()

Returns string for this Rect.

Parameter
Type
Description

New

static SRect New (float x, float y, float width, float height)

Constructs a new SRect

Parameter
Type
Description

Properties

X

float X get set

Property Description

Y

float Y get set

Property Description

Width

float Width get set

Property Description

Height

float Height get set

Property Description

Position

Position get

The X and Y position of the rectangle.

Center

Center get

The position of the center of the rectangle.

Min

Min get

The position of the minimum corner of the rectangle.

Max

Max get

The position of the maximum corner of the rectangle.

Size

Size get

The width and height of the rectangle.

XMin

float XMin get

The minimum X coordinate of the rectangle.

YMin

float YMin get

The minimum Y coordinate of the rectangle.

XMax

float XMax get

The maximum Y coordinate of the rectangle.

YMax

float YMax get

The maximum Y coordinate of the rectangle.

Left

float Left get

Property Description

Right

float Right get

Property Description

Top

float Top get

Property Description

Bottom

float Bottom get

Property Description

SQuaternion

Index

Functions Index

Function

float get

float get

float get

float get

float get

float get

float get

bool Contains (SVector point) bool Contains (SVector point, bool allowInverse)

bool Overlaps (SRect other) bool Overlaps (SRect other, bool allowInverse)

bool Equals (SRect other)

string ToString (string format) string ToString ()

Static Functions

static SRect New (float x, float y, float width, float height)

float X get set

float Y get set

float Width get set

float Height get set

SVector Position get

SVector Center get

SVector Min get

SVector Max get

SVector Size get

SVector
SVector
SVector
SVector
SVector
SVector
SVector

float get

string ()

float (SQuaternion b)

SQuaternion (SQuaternion b, float t)

SQuaternion (SQuaternion b, float t)

SQuaternion (SQuaternion b, float delta)

float (SQuaternion b)

bool (SQuaternion other)

Static Functions

static SQuaternion (float x, float y, float z, float w)

static SQuaternion (float x, float y, float z)

Properties Index

Property

float get set

float get set

float get set

float get set

SVector get

SQuaternion get

Static Properties

static SQuaternion get

Functions

ToString

string ToString ()

Converts a quaternion to a human readable string

Angle

float Angle (SQuaternion b)

Returns the angle between two quaternions

Parameter
Type
Description

Lerp

SQuaternion Lerp (SQuaternion b, float t)

Linearly interpolates between this and other quaternion, by factor t and returns the result

Parameter
Type
Description

Slerp

SQuaternion Slerp (SQuaternion b, float t)

Spherically interpolates between this and other quaternion, by factor t and returns the result

Parameter
Type
Description

RotateTowards

SQuaternion RotateTowards (SQuaternion b, float delta)

Rotates this towards other, by no more than t degrees

Parameter
Type
Description

Dot

float Dot (SQuaternion b)

Returns the dot product of this and another quaternion

Parameter
Type
Description

Equals

bool Equals (SQuaternion other)

Function Description

Parameter
Type
Description

other

SQuaternion

The other Quaternion that we are comparing with.

New

static SQuaternion New (float x, float y, float z, float w)

Creates a new Quaternion

Parameter
Type
Description

Euler

static SQuaternion Euler (float x, float y, float z)

Creates a quaternion using Euler angles.

Parameter
Type
Description

AngleAxis

static SQuaternion AngleAxis (SVector axis, float angle)

Creates a quaternion from an Angle/Axis pair

Parameter
Type
Description

LookRotation

static SQuaternion LookRotation (SVector forward) static SQuaternion LookRotation (SVector forward, SVector up)

Creates a quaternion a forward vector; presuming up is (0,1,0)

Parameter
Type
Description

operator*

static SVector operator* (SQuaternion a, SVector b) static SQuaternion operator* (SQuaternion a, SQuaternion b)

The result of using the * operator.

Parameter
Type
Description

FromToRotation

static SQuaternion FromToRotation (SVector a, SVector b)

Creates a rotation which rotates from a to b.

Usually you use this to rotate a transform so that one of its axes eg. the y-axis - follows a target direction b in world space.

Parameter
Type
Description

Properties

X

float X get set

X axis

Y

float Y get set

Y axis

Z

float Z get set

Z axis

W

float W get set

W axis

EulerAngles

SVector EulerAngles get

Returns the Euler rotation for this Quaternion

Inverse

SQuaternion Inverse get

Returns the inverse of this quaternion

Identity

static SQuaternion Identity get

Equivalent of new SQuaternion(0,0,0,1)

newRect=Rect.New(0,0,150,150)
otherRect = Rect.New(0,0,150,150)

isContains = newRect.Contains(otherRect)
--or
isContains = newRect.Contains(otherRect , true)
newRect=Rect.New(0,0,150,150)
otherRect = Rect.New(0,0,150,150)

isOverlapping = newRect.Overlaps(otherRect)
--or
isOverlapping = newRect.Overlaps(otherRect , true)
newRect=Rect.New(0,0,150,150)
otherRect = Rect.New(0,0,150,150)
AreEqual = newRect.Equals(otherRect)
newRect=Rect.New(0,0,150,150)
otherRect = Rect.New(0,0,150,150)
AreEqual = newRect.Equals(otherRect)
newRect=Rect.New(0,0,150,150)
newRect=Rect.New(0,0,150,150)
newRect.X = 10.0
newRect=Rect.New(0,0,150,150)
newRect.Y = 10.0
newRect=Rect.New(0,0,150,150)
newRect.Width = 10.0
newRect=Rect.New(0,0,150,150)
newRect.Height = 10.0
newRect=Rect.New(50,50,150,150)
positionVector = newRect.position
newRect = Rect.New(50,50,150,150)
VectorCenter = newRect.Center
newRect=Rect.New(0,0,150,150)
vectorMin = newRect.Min
newRect=Rect.New(0,0,150,150)
vectorMax = newRect.Max
newRect=Rect.New(0,0,150,150)
vectorSize = newRect.Size
newRect=Rect.New(0,0,150,150)
floatXMin = newRect.XMin
newRect=Rect.New(0,0,150,150)
floatYMin = newRect.YMin
newRect=Rect.New(0,0,150,150)
floatXMax = newRect.XMax
newRect=Rect.New(0,0,150,150)
floatYMax = newRect.YMax
newRect=Rect.New(0,0,150,150)
floatLeft = newRect.Left
newRect=Rect.New(0,0,150,150)
floatRight = newRect.Right
newRect=Rect.New(0,0,150,150)
floatTop = newRect.Top
newRect=Rect.New(0,0,150,150)
floatBottom = newRect.Bottom
aQuaternion = Quaternion.New(0.0, 1.0, 0.0, 0.0)
theString = aQuaternion.ToString()
local newQuat = Quaternion.New(0.0, 0.707, 0.0, 0.707);
local otherQuat = Quaternion.New(0.0, 1.0, 0.0, 0.0);
angle = newQuat.Angle(otherQuat);

Space.Log(angle);
-- prints 90.0173034667969
QuatA = Quaternion.New(0.0, 0.707, 0.0, 0.707)
QuatB = Quaternion.New(0.0, 1.0, 0.0, 0.0)
QuatLerpAB = QuatA.Lerp(QuatB, Space.Time * 0.1)
local cube = Space.Host.ExecutingObject

local fromQuat = cube.LocalRotation
local toQuat = Quaternion.New(0.0, 0.707, 0.0, 0.707)
local speed = 0.1

-- The cube will rotate 90 degrees from current rotation by speed amount.
local moveCube = function()
  cube.LocalRotation = fromQuat.Lerp(toQuat, Space.Time * speed);
end

cube.OnUpdate(moveCube)
QuatA = Quaternion.New(0.0, 0.707, 0.0, 0.707)
QuatB = Quaternion.New(0.0, 1.0, 0.0, 0.0)
QuatLerpAB = QuatA.Slerp(QuatB, Space.Time * 0.1)
local cube = Space.Host.ExecutingObject;

local fromQuat = cube.LocalRotation;
local toQuat = Quaternion.New(0.0, 1.0, 0.0, 0.0);
local speed = 0.1;

-- The cube will rotate 180 degrees from current rotation by speed amount.
local moveCube = function()
  cube.LocalRotation = fromQuat.Slerp(toQuat, Space.Time * speed)
end

cube.OnUpdate(moveCube)
QuatA = Quaternion.New(0.0, 0.707, 0.0, 0.707)
QuatB = Quaternion.New(0.0, 1.0, 0.0, 0.0)
ARotatedTowardB = QuatA.RotateTowards(QuatB, Space.Time * 0.1)
local cube = Space.Host.ExecutingObject

local fromQuat = cube.LocalRotation
local target = Quaternion.New(0.0, 0.707, 0.0, 0.707)
local speed = 10.0

-- The cube will rotate 90 degrees from current rotation by step amount.
local moveCube = function()
  local step = speed * Space.Time
  cube.LocalRotation = fromQuat.RotateTowards(target, step)
end

cube.OnUpdate(moveCube)
local quat = Quaternion.New(0.0, 0.707, 0.0, 0.707);
local quatOther = Quaternion.New(0.0, 0.0, 0.0, 1.0);
Space.Log(quat.Dot(quatOther));
-- prints 0.707000017166138
QuatA = Quaternion.New(0.0, 0.707, 0.0, 0.707)
QuatB = Quaternion.New(0.0, 1.0, 0.0, 0.0)
isEqual = QuatA.Equals(QuatB)
newQuat = Quaternion.New(0.0, 0.707, 0.0, 0.707)
newQuat = Quaternion.Euler(0.0, 90.0, 0.0)
newVector = Vector.New(0.0, 90.0, 0.0)
newQuat = Quaternion.AngleAxis(newVector, 90.0)
local newQuat = Quaternion.LookRotation(Vector.Forward);
-- or
local newQuat = Quaternion.LookRotation(Vector.Forward, Vector.Up);
newQuat = Quaternion.New(0.0, 1.0, 0.0, 0.0)
newVector = Vector.Forward
rotatedVector = newQuat * newVector

--or

newQuat = Quaternion.New(0.0, 0.707, 0.0, 0.707)
newVector = Vector.New(0.0, 0.0, 0.0)
rotatedVector = newQuat * newQuat
VectorA = Vector.New(0.0,1.0,0.0)
VectorB = Vector.New(1.0,0.0,0.0)
QuaternionFromToRotation = Quaternion.FromToRotation(VectorA, VectorB)
newQuat = Quaternion.New(0.0, 1.0, 0.0, 0.0)
newQuat.X = 40.0
obj = Space.Host.ExecutingObject
originalRot = obj.LocalRotation

onStartMethod = function()
  Space.Log(originalRot.x)
  -- prints the X component of this object as a float

  originalRot.x = 0.25
  -- assigns 0.25 value to the X component

  obj.LocalRotation = originalRot
  -- sets the the new rotation
end

obj.OnStart(onStartMethod)
newQuat = Quaternion.New(0.0, 1.0, 0.0, 0.0)
newQuat.Y = 40.0
 obj = Space.Host.ExecutingObject
 originalRot = obj.LocalRotation

 onStartMethod = function()
  Space.Log(originalRot.y);
  -- prints the Y component of this object as a float

  originalRot.y = 0.25;
  -- assigns 0.25 value to the Y component

  obj.LocalRotation = originalRot;
  -- sets the the new rotation
end

obj.OnStart(onStartMethod);
newQuat = Quaternion.New(0.0, 1.0, 0.0, 0.0)
newQuat.Z = 40.0
local obj = Space.Host.ExecutingObject;
local originalRot = obj.LocalRotation;
obj.SubscribeToEvents();

local onStartMethod = function()
  Space.Log(originalRot.z);
  -- prints the Z component of this object as a float

  originalRot.z = 0.25;
  -- assigns 0.25 value to the Z component

  obj.LocalRotation = originalRot;
  -- sets the the new rotation
end

obj.OnStart(onStartMethod);
newQuat = Quaternion.New(0.0, 1.0, 0.0, 0.0)
newQuat.W = 40.0
local obj = Space.Host.ExecutingObject;
local originalRot = obj.LocalRotation;
obj.SubscribeToEvents();

local onStartMethod = function()
  Space.Log(originalRot.w);
  -- prints the W component of this object as a float

  originalRot.w = 0.25;
  -- assigns 0.25 value to the W component

  obj.LocalRotation = originalRot;
  -- sets the the new rotation
end

obj.OnStart(onStartMethod);
newQuat = Quaternion.New(0.0, 0.707, 0.0, 0.707)
euler = newQuat.EulerAngles
quat = Quaternion.New(0.0, 0.707, 0.0, 0.707)
inverseQuat = quat.Inverse
identity = Quaternion.Identity
XMin
YMin
XMax
YMax
Left
Right
Top
Bottom

static SQuaternion AngleAxis (SVector axis, float angle)

static SQuaternion LookRotation (SVector forward) static SQuaternion LookRotation (SVector forward, SVector up)

static SVector operator (SQuaternion a, SVector b) static SQuaternion operator (SQuaternion a, SQuaternion b)

static SQuaternion FromToRotation (SVector a, SVector b)

ToString
Angle
Lerp
Slerp
RotateTowards
Dot
Equals
New
Euler
X
Y
Z
W
EulerAngles
Inverse
Identity

SDateTime

Index

Functions Index

Function Name

Properties Index

Property Name

Functions

Equals

bool Equals (SDateTime other)

Returns true if the datetimes are same.

Parameter
Type
Description

ComparesTo

int ComparesTo (SDateTime other)

Compares two datetimes and returns an integer. 0 == identical. greater than 0 == This datetime is greater than other. less than 0 == This datetime is less than other.

Parameter
Type
Description

FormatLocal

string FormatLocal (string format)

Outputs a custom formatted string with the date and time according to local language rules.

Parameter
Type
Description

FunctionName

string FormatGlobal (string format)

Outputs a custom formatted string with the date and time according to global rules (culture invariant).

Parameter
Type
Description

Regional

string Regional (string region)

Outputs a string with the date and time formatted according to specific regional rules.

Parameter
Type
Description

FormatRegional

string FormatRegional (string region, string format)

Outputs a custom formatted string with the date and time according to specific regional rules.

Parameter
Type
Description

AddYears

SDateTime AddYears (int amount)

Return a new SDateTime that is the current date time + amount years.

Parameter
Type
Description

AddMonths

SDateTime AddMonths (int amount)

Return a new SDateTime that is the current date time + amount months.

Parameter
Type
Description

AddDays

SDateTime AddDays (double amount)

Return a new SDateTime that is the current date time + amount days.

Parameter
Type
Description

AddHours

SDateTime AddHours (double amount)

Return a new SDateTime that is the current date time + amount hours.

Parameter
Type
Description

AddMinutes

SDateTime AddMinutes (double amount)

Return a new SDateTime that is the current date time + amount minutes.

Parameter
Type
Description

AddSeconds

SDateTime AddSeconds (double amount)

Return a new SDateTime that is the current date time + amount seconds.

Parameter
Type
Description

AddMilliseconds

SDateTime AddMilliseconds (double amount)

Return a new SDateTime that is the current date time + amount milliseconds.

Parameter
Type
Description

Now

static SDateTime Now()

Creates a new SDateTime object equal to the current local time.

Parameter
Type
Description

Server

static SDateTime Server ()

Creates a new SDateTime object equal to the current server time.

Parameter
Type
Description

Parse

static SDateTime Parse (string input)

Creates a new SDateTime object by attempting to parse a string input. Returns null/nil if the string cannot be parsed.

Parameter
Type
Description

IsLeapYear

static bool IsLeapYear (int year)

Return true if the specified year is a leap year.

Parameter
Type
Description

DaysInMonth

static int DaysInMonth (int year, int month)

Return the number of days in the given month for the given year.

Parameter
Type
Description

Properties

Year

int Year get

Get the independent time unit property of the SDateTime object.

Month

int Month get

Property Description

Day

int Day get

Property Description

Hour

int Hour get

Property Description

Minute

int Minute get

Property Description

Second

int Second get

Property Description

Millisecond

int Millisecond get

Property Description

Local

string Local get

Outputs a string with the date and time formatted according to local language rules.

Global

string Global get

Outputs a string with the date and time formatted according to global rules (culture invariant).

UnixTime

int UnixTime get

Return this time in Unix time, the number of seconds since Jan 1st, 1970.

IsDaylightSavingTime

bool IsDaylightSavingTime get

Indicates whether this instance of DateTime is within the daylight saving time range for the current time zone.

SDateTime (double amount)

Static Functions

static SDateTime ()

static SDateTime ()

static SDateTime (string input)

static bool (int year)

static int (int year, int month)

bool get

bool Equals (SDateTime other)

int ComparesTo (SDateTime other)

string FormatLocal (string format)

string FormatGlobal (string format)

string Regional (string region)

string FormatRegional (string region, string format)

SDateTime AddYears (int amount)

SDateTime AddMonths (int amount)

SDateTime AddDays (double amount)

SDateTime AddHours (double amount)

SDateTime AddMinutes (double amount)

int Year get

int Month get

int Day get

int Hour get

int Minute get

int Second get

int Millisecond get

string Local get

string Global get

format

string

See below for examples

region

string

List available here

region

string

List available here

format

string

See below

SDateTime (double amount)

int get

ATargetDateTime = DateTime.Now().AddMinutes(5)
AreEqual = ATargetDateTime.Equals(DateTime.Now())
ATargetDateTime = DateTime.Now().AddMinutes(5)
AreEqual = ATargetDateTime.ComparesTo(DateTime.Now())
localTimeCustomFormat = DateTime.Now().FormatLocal("dddd, MMMM dd, yyyy h:mm:ss tt")
--Example format strings

--[[ 
format = "dddd, MMMM dd, yyyy h:mm:ss tt"
Result: Monday, May 28, 2012 11:35:00 AM

format = "Ldddd, MMMM dd, yyyy"
Result: Monday, May 28, 2012

 format = "h:mm:ss tt"
 Result: 11:35:00 AM

 format = "MMMM dd"
Result: May 28

 format = "ddd, dd MMM yyyy HH':'mm':'ss 'GMT"
Result: Mon, 28 May 2012 11:35:00 GMT

 format = "M/d/yyyy"
 Result: 5/28/2012

 format = "h:mm tt"
Result: 11:35 AM

format = "yyyy'-'MM'-'dd'T'HH':'mm':'ss"
Result: 2012-05-28T11:35:00

format = "yyyy'-'MM'-'dd HH':'mm':'ss'Z'"
 Result: 2012-05-28 11:35:00Z

format = "MMMM, yyyy"
 Result: May, 2012
    --]]
GlobalTimeCustomFormat = DateTime.Now().FormatLocal("dddd, MMMM dd, yyyy h:mm:ss tt")
--Example format strings

--[[ 
format = "dddd, MMMM dd, yyyy h:mm:ss tt"
Result: Monday, May 28, 2012 11:35:00 AM

format = "Ldddd, MMMM dd, yyyy"
Result: Monday, May 28, 2012

 format = "h:mm:ss tt"
 Result: 11:35:00 AM

 format = "MMMM dd"
Result: May 28

 format = "ddd, dd MMM yyyy HH':'mm':'ss 'GMT"
Result: Mon, 28 May 2012 11:35:00 GMT

 format = "M/d/yyyy"
 Result: 5/28/2012

 format = "h:mm tt"
Result: 11:35 AM

format = "yyyy'-'MM'-'dd'T'HH':'mm':'ss"
Result: 2012-05-28T11:35:00

format = "yyyy'-'MM'-'dd HH':'mm':'ss'Z'"
 Result: 2012-05-28 11:35:00Z

format = "MMMM, yyyy"
 Result: May, 2012
    --]]
stringTimeRegional = DateTime.Now().Regional('en-us')
stringTimeFormatRegional = DateTime.Now().FormatRegional('en-us','dddd, MMMM dd, yyyy h:mm:ss tt')
--Example format strings

--[[ 
format = "dddd, MMMM dd, yyyy h:mm:ss tt"
Result: Monday, May 28, 2012 11:35:00 AM

format = "Ldddd, MMMM dd, yyyy"
Result: Monday, May 28, 2012

 format = "h:mm:ss tt"
 Result: 11:35:00 AM

 format = "MMMM dd"
Result: May 28

 format = "ddd, dd MMM yyyy HH':'mm':'ss 'GMT"
Result: Mon, 28 May 2012 11:35:00 GMT

 format = "M/d/yyyy"
 Result: 5/28/2012

 format = "h:mm tt"
Result: 11:35 AM

format = "yyyy'-'MM'-'dd'T'HH':'mm':'ss"
Result: 2012-05-28T11:35:00

format = "yyyy'-'MM'-'dd HH':'mm':'ss'Z'"
 Result: 2012-05-28 11:35:00Z

format = "MMMM, yyyy"
 Result: May, 2012
    --]]
date5YearsLater = DateTime.Now().AddYears(5)
date5MonthsLater = DateTime.Now().AddMonths(5)
date5DaysLater = DateTime.Now().AddDays(5)
date5HoursLater = DateTime.Now().AddHours(5)
date5MinutesLater = DateTime.Now().AddMinutes(5)
date5SecondsLater = DateTime.Now().AddSeconds(5)
date5MillisecondsLater = DateTime.Now().AddMilliseconds(5)
localDateTime = DateTime.Now()
serverDateTime = DateTime.Server()
parseDateTime = DateTime.Parse('10/3/2022 1:26:02 PM')
isLeapYear = DateTime.IsLeapYear(2024)
isLeapYear = DateTime.DaysInMonth(2022, 8)
currentYear = DateTime.Now().Year
currentMonth = DateTime.Now().Month
currentDay = DateTime.Now().Day
currentHour = DateTime.Now().Hour
currentMinute = DateTime.Now().Minute
currentSecond = DateTime.Now().Second
currentMillisecond = DateTime.Now().Millisecond
currentTimeStringLocal = DateTime.Now().Local
currentTimeStringGlobal = DateTime.Now().Global
currentUnixTime = DateTime.Now().UnixTime
isCurrentTimeDaylightSaving = DateTime.Now().IsDaylightSavingTime
AddSeconds
AddMilliseconds
Now
Server
Parse
IsLeapYear
DaysInMonth
UnixTime
IsDaylightSavingTime

SVector

Index

Functions Index

Function

Properties Index

Property

Functions

Add

SVector Add (SVector other) SVector Add (float other)

Adds this Vector

Parameter
Type
Description

Scale

SVector Scale (SVector other) SVector Scale (float other)

Multiplies this Vector

Parameter
Type
Description

Divide

SVector Divide (SVector other) SVector Divide (float other)

Divides this Vector

Parameter
Type
Description

Distance

float Distance (SVector other)

Returns the distance between this vector and other in meters

Parameter
Type
Description

SquareDistance

float SquareDistance (SVector other)

Returns the square of the distance between this vector and other in meters, considerably faster than distance()

Parameter
Type
Description

InRange

bool InRange (SVector other, float range)

Returns if other is within range meters of this vector, inclusive

Parameter
Type
Description

Cross

SVector Cross (SVector other)

Returns the cross product of this vector and other

Parameter
Type
Description

Lerp

SVector Lerp (SVector other, float t)

Linear interpolates between this and other based on factor t (0-1)

Parameter
Type
Description

Slerp

SVector Slerp (SVector other, float t)

Spherically linear interpolates between this and other based on factor t (0-1)

Parameter
Type
Description

MoveTowards

SVector MoveTowards (SVector other, float maxDistance)

Moves this vector closer to other by a maximum of maxDistance units

Parameter
Type
Description

Dot

float Dot (SVector other)

Returns the dot product between this and other (note - normalise your vectors first!

Parameter
Type
Description

Equals

bool Equals (SVector other)

Function Description

Parameter
Type
Description

ToString

string ToString ()

Function Description

New

static SVector New (float x, float y, float z)

Initialises vector from three floats

Parameter
Type
Description

operator+

static SVector operator+ (SVector a, SVector b) static SVector operator+ (SVector a, float b)

Function Description

Parameter
Type
Description

operator-

static SVector operator- (SVector a, SVector b) static SVector operator- (SVector a, float b)

Function Description

Parameter
Type
Description

operator*

static SVector operator* (SVector a, SVector b) static SVector operator* (SVector a, float b)

Function Description

Parameter
Type
Description

operator/

static SVector operator/ (SVector a, SVector b) static SVector operator/ (SVector a, float b)

Function Description

Parameter
Type
Description

Properties

X

float X get set

X axis (red axis)

Y

float Y get set

Y axis (green axis)

Z

float Z get set

Z axis (blue axis)

Magnitude

float Magnitude get

Returns the magnitude of this vector

Normalised

SVector Normalised get

Returns the normalised version of this vector

Up

static SVector Up get

Equivalent of new SVector(0,1,0)

Down

static SVector Down get

Equivalent of new SVector(0,-1,0)

Left

static SVector Left get

Equivalent of new SVector(-1,0,0)

Right

static SVector Right get

Equivalent of new SVector(1,0,0)

Forward

static SVector Forward get

Equivalent of new SVector(0,0,1)

Back

static SVector Back get

Equivalent of new SVector(0,0,-1)

Zero

static SVector Zero get

Equivalent of new SVector(0,0,0)

One

static SVector One get

Equivalent of new SVector(1,1,1)

MaxValue

static SVector MaxValue get

Contains the largest possible vector [3.402823E+38, 3.402823E+38, 3.402823E+38]

MinValue

static SVector MinValue get

Contains the largest possible negative vector

string ()

Static Functions

static SVector (float x, float y, float z)

static SVector + (SVector a, SVector b) static SVector + (SVector a, float b)

static SVector - (SVector a, SVector b) static SVector - (SVector a, float b)

static SVector * (SVector a, SVector b) static SVector * (SVector a, float b)

static SVector / (SVector a, SVector b) static SVector / (SVector a, float b)

static SVector get

static SVector get

static SVector get

static SVector get

static SVector get

static SVector get

static SVector get

SVector Add (SVector other) SVector Add (float other)

SVector Scale (SVector other) SVector Scale (float other)

SVector Divide (SVector other) SVector Divide (float other)

float Distance (SVector other)

float SquareDistance (SVector other)

bool InRange (SVector other, float range)

SVector Cross (SVector other)

SVector Lerp (SVector other, float t)

SVector Slerp (SVector other, float t)

SVector MoveTowards (SVector other, float maxDistance)

float Dot (SVector other)

float X get set

float Y get set

float Z get set

float Magnitude get

SVector Normalised get

Static Properties

static SVector Up get

static SVector Down get

bool (SVector other)

static SVector get

local vector = Vector.New(0, 10, 0);
local vectorOther = Vector.New(40, 50, 6);
Space.Log(vector.Add(vectorOther));
-- prints [40, 60, 6]

Space.Log(vector + vectorOther);
-- prints [40, 60, 6]
local vectorB = Vector.New(0, 10, 0);
Space.Log(vectorB.Add(5));
-- prints [5, 15, 5]
local vector = Vector.New(0, 10, 0);
local vectorOther = Vector.New(2, 5, 4);
Space.Log(vector.Scale(vectorOther));
-- prints [0, 50, 0]

Space.Log(vector * vectorOther);
-- prints [0, 50, 0]
local vector = Vector.New(0, 10, 0);
Space.Log(vector.Scale(5));
-- prints [0, 50, 0]

Space.Log(vector * 5);
-- prints [0, 50, 0]
local vector = Vector.New(10, 10, 10);
local vectorOther = Vector.New(2, 2, 2);
Space.Log(vector.Divide(vectorOther));
-- prints [5, 5, 5]

Space.Log(vector / vectorOther);
-- prints [5, 5, 5]
local vector = Vector.New(10, 10, 10);
Space.Log(vector.Divide(2));
-- prints [5, 5, 5]

Space.Log(vector / 2);
-- prints [5, 5, 5]
local vector = Vector.New(3, 3, 3.5);
local vectorOther = Vector.New(2, 2, 2);
Space.Log(vector.Distance(vectorOther));
-- prints 2.06155276298523
--the below script will change the objects color to green if you are near the object 
--and change color to red if you are far from the object 

thisGameObject = Space.Host.ExecutingObject

function OnUpdate()
  positionAvatar = Space.Scene.PlayerAvatar.GameObject.WorldPosition
  positionObject = thisGameObject.WorldPosition
  
     if positionAvatar.Distance(positionObject) < 5 then
         thisGameObject.Renderer.Material.SetColor("_Color",0,1,0,1)
      else
         thisGameObject.Renderer.Material.SetColor("_Color",1,0,0,1)
      end
  
end  

thisGameObject.OnUpdate(OnUpdate)
local vector = Vector.New(3, 3, 3.5);
local vectorOther = Vector.New(2, 2, 2);
Space.Log(vector.SquareDistance(vectorOther));
-- prints 4.25
--the below script will change the objects color to green if you are near the object 
--and change color to red if you are far from the object 

thisGameObject = Space.Host.ExecutingObject

function OnUpdate()
  positionAvatar = Space.Scene.PlayerAvatar.GameObject.WorldPosition
  positionObject = thisGameObject.WorldPosition
  
     if positionAvatar.SquareDistance(positionObject) < 25 then
         thisGameObject.Renderer.Material.SetColor("_Color",0,1,0,1)
      else
         thisGameObject.Renderer.Material.SetColor("_Color",1,0,0,1)
      end
  
end  

thisGameObject.OnUpdate(OnUpdate)
local vector = Vector.New(370, 30, 0);
local vectorOther = Vector.New(372, 30, 0);
Space.Log(vector.InRange(vectorOther, 2.0));
-- prints True

local vector2 = Vector.New(80, 30, 20);
local vectorOther2 = Vector.New(1, 15, 25);
Space.Log(vector2.InRange(vectorOther2, 1.0));
-- prints False
--the below script will change the objects color to green if you are near the object 
--and change color to red if you are far from the object 
--(example: motion sensor lights)

thisGameObject = Space.Host.ExecutingObject

function OnUpdate()
  positionAvatar = Space.Scene.PlayerAvatar.GameObject.WorldPosition
  positionObject = thisGameObject.WorldPosition
  
     if positionAvatar.InRange(positionObject, 5.0) then
         thisGameObject.Renderer.Material.SetColor("_Color",0,1,0,1)
      else
         thisGameObject.Renderer.Material.SetColor("_Color",1,0,0,1)
      end
  
end  

thisGameObject.SubscribeToEvents()
thisGameObject.OnUpdate(OnUpdate)
local vector = Vector.New(0, 1, 0);
local vectorOther = Vector.New(1, 0, 0);
Space.Log(vector.Cross(vectorOther));
-- prints [0, 0, -1]
lerpVector = currentVector.Lerp(targetVector, 0.5)
-- Lua Translation of Unity C# Documentation

--[["StartMarker" and "EndMaker" are game objects set up as endpoints.
These objects are attached to the script in the Object Reference section.
The name fields in that section should match these names for the example. --]]
local startMarker = Space.Host.GetReference("StartMarker");
local endMarker = Space.Host.GetReference("EndMarker");
local ball = Space.Host.ExecutingObject;
local speed = 1.0;
local startTime;
local journeyLength;
ball.SubscribeToEvents();

local onStartMethod = function()
  startTime = Space.Time;
  journeyLength = startMarker.LocalPosition.Distance(endMarker.LocalPosition);
end

-- This ball object will move from the start endpoint object to the end endpoint.
local moveBall = function()
  local distCovered = (Space.Time - startTime) * speed;
  local fracJourney = distCovered / journeyLength;
  ball.LocalPosition = startMarker.LocalPosition.Lerp(endMarker.LocalPosition, fracJourney);
end

ball.OnStart(onStartMethod);
ball.OnUpdate(moveBall);
slerpVector = currentVector.Slerp(targetVector, 0.5)
-- Lua Translation of Unity C# Documentation

--[["Sunrise" and "Sunset" are game objects set up as endpoints.
These objects are attached to the script in the Object Reference section.
The name fields in that section should match these names for the example. --]]
local sunrise = Space.Host.GetReference("Sunrise");
local sunset = Space.Host.GetReference("Sunset");

local ball = Space.Host.ExecutingObject;
local startTime;
local journeyTime = 1.0;
ball.SubscribeToEvents();

local onStartMethod = function()
  startTime = Space.Time;
end

-- This ball object will move from the start endpoint object to the end endpoint.
local moveBall = function()
  local center = (sunrise.LocalPosition + sunset.LocalPosition) * 0.5;
  center = center - Vector.Up;
  local riseRelCenter = sunrise.LocalPosition - center;
  local setRelCenter = sunset.LocalPosition - center;
  local fracComplete = (Space.Time - startTime) / journeyTime;

  ball.LocalPosition = riseRelCenter.Slerp(setRelCenter, fracComplete);
  ball.LocalPosition = ball.LocalPosition + center;
end

ball.OnStart(onStartMethod);
ball.OnUpdate(moveBall);
newVector = currentVector.MoveTowards(targetVector)
-- Lua Translation of Unity C# Documentation

--[["Target" is a game object set up as a target position.
This object is attached to the script in the Object Reference section.
The name field in that section should match this name for the example. --]]
local target = Space.Host.GetReference("Target");

local ball = Space.Host.ExecutingObject;
local speed = 1.0;Vecto

local onStartMethod = function()
  startTime = Space.Time;
end

-- This ball object will move towards the target. Negative values for
-- the maxDistance parameter will push the ball away from the target.
local moveBall = function()
  local step = speed * Space.DeltaTime;
  ball.LocalPosition = ball.LocalPosition.MoveTowards(target.LocalPosition, step);
end

ball.OnStart(onStartMethod);
ball.OnUpdate(moveBall);

-- NOTE: If you use MoveTowards, the movement will not overshoot the target.
local vectorA = Vector.New(0, 1, 0);
local vectorOtherA = Vector.New(1, 0, 0);
Space.Log(vectorA.Dot(vectorOtherA));
-- prints 0

local vectorB = Vector.New(0, 1, 0);
local vectorOtherB = Vector.New(0, 1, 0);
Space.Log(vectorB.Dot(vectorOtherB));
-- prints 1

local vectorC = Vector.New(0, 1, 0);
local vectorOtherC = Vector.New(0, -1, 0);
Space.Log(vectorC.Dot(vectorOtherC));
-- prints -1
isEqual = Vector.Up.Equals( Vector.New(0,1,0) )
stringVector = Vector.New(0,0,0).ToString()
newVector = Vector.New(0, 1, 0)
example 1
example 1
example 1
example 1
newVect = Vector.New(0,0,0)
newVect.X = 5.0
local obj = Space.Host.ExecutingObject;
local originalPos = obj.LocalPosition;
obj.SubscribeToEvents();

local onStartMethod = function()
  Space.Log(originalPos.x);
  -- prints the X axis position of this object as a float

  originalPos.x = 100.0;
  -- assigns 100.0 value to the X axis position of this object

  obj.LocalPosition = originalPos;
  -- sets the the new position
end

obj.OnStart(onStartMethod);
newVect = Vector.New(0,0,0)
newVect.Y = 5.0
local obj = Space.Host.ExecutingObject;
local originalPos = obj.LocalPosition;
obj.SubscribeToEvents();

local onStartMethod = function()
  Space.Log(originalPos.y);
  -- prints the Y axis position of this object as a float

  originalPos.y = 100.0;
  -- assigns 100.0 value to the Y axis position of this object

  obj.LocalPosition = originalPos;
  -- sets the the new position
end

obj.OnStart(onStartMethod);
newVect = Vector.New(0,0,0)
newVect.Z = 5.0
local obj = Space.Host.ExecutingObject
local originalPos = obj.LocalPosition

local onStartMethod = function()
  Space.Log(originalPos.z)
  -- prints the Z axis position of this object as a float

  originalPos.z = 100.0
  -- assigns 100.0 value to the Z axis position of this object

  obj.LocalPosition = originalPos
  -- sets the the new position
end

obj.OnStart(onStartMethod)
vector = Vector.New(1.0, 5.0, 0.0)
vectorMagnitude = vector.Magnitude
vector = Vector.New(0.0, 10.0, 0.0)
vectorNormalised = vector.Normalised
up = Vector.Up
--this script will make clicking this object move 2 units up on the world Y axis
thisObject = Space.Host.ExecutingObject

OnClick = function()
  
  thisObject.WorldPosition = thisObject.WorldPosition + (Vector.Up * 2)
  
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClick)
down = Vector.Down
--this script will make clicking this object move 2 units down on the world Y axis
thisObject = Space.Host.ExecutingObject

OnClick = function()
  
  thisObject.WorldPosition = thisObject.WorldPosition + (Vector.Down * 2)
  
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClick)
left = Vector.Left
--this script will make clicking this object move 2 units left on the world X axis
thisObject = Space.Host.ExecutingObject

OnClick = function()
  
  thisObject.WorldPosition = thisObject.WorldPosition + (Vector.Left * 2)
  
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClick)
right = Vector.Right
--this script will make clicking this object move 2 units right on the world X axis
thisObject = Space.Host.ExecutingObject

OnClick = function()
  
  thisObject.WorldPosition = thisObject.WorldPosition + (Vector.Right * 2)
  
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClick)
forward = Vector.Forward
--this script will make clicking this object move 2 units Forward on the world Z axis
thisObject = Space.Host.ExecutingObject

OnClick = function()
  
  thisObject.WorldPosition = thisObject.WorldPosition + (Vector.Forward * 2)
  
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClick)
back = Vector.Back
--this script will make clicking this object move 2 units Back on the world Z axis
thisObject = Space.Host.ExecutingObject

OnClick = function()
  
  thisObject.WorldPosition = thisObject.WorldPosition + (Vector.Back * 2)
  
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClick)
vectorZero  = Vector.Zero
--clicking this object move it to the center of the region <0,0,0>
thisObject = Space.Host.ExecutingObject

OnClick = function()

  thisObject.WorldPosition = Vector.Zero

end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClick)
vectorOne = Vector.One
--clicking this object move it to the <1,1,1> coordinates of the region.
thisObject = Space.Host.ExecutingObject

OnClick = function()

  thisObject.WorldPosition = Vector.One

end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClick)
vectorMaxValue = Vector.MaxValue
vectorMinValue = Vector.MinValue
Equals
ToString
New
operator
operator
operator
operator
operator
operator
operator
operator
Left
Right
Forward
Back
Zero
One
MaxValue
MinValue

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

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

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.

Parameter
Type
Description

Teleport

void Teleport (string landmarkName) void Teleport ( position) void Teleport ( position, rotation) void Teleport (int region) void Teleport (int region, position, rotation)

Teleport the avatar.

Parameter
Type
Description

SetIKGoal

void SetIKGoal (string goal, bool positionGoal, float positionStrength, positionTarget, bool rotationGoal, float rotationStrength, 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 ( animationClip)

Play a custom animation on the avatar.

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

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.

Parameter
Type
Description

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.

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

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

LockObject get

The object the Avatar is to. Returns Null if Avatar is not attached.

Skeleton

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

GameObject get

The reference to the Avatar's GameObject

bone

string

Name of a UnityEngine.HumanBodyBones value (case‑insensitive), e.g., "LeftShoulder", "Head".

o

Closure (callback)

A function that will be called once the OnAvatarReload event is triggered.

o

Closure (callback)

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

withinSeconds

long

Maximum seconds ahead to consider for auto-teleport. Defaults to 600.

SGameObject
SVector
SVector
SQuaternion
SVector
SQuaternion
SVector
SQuaternion
SResource
SGameObject
Attached
SGameObject
SGameObject
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)  
Space.Scene.PlayerAvatar.Detach()
 --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)   
function OAA()
--
end
Space.Scene.PlayerAvatar.OnAvatarAttached(OAA)
function OAD()
--
end
Space.Scene.PlayerAvatar.OnAvatarDetached(OAD)
local avatar=Space.Scene.PlayerAvatar
avatar.LoadOutfit(10001)
 --the below script changes the player's outfit into 
--a pre-defined outfit if they click the object containing the script
--(Example: Player clicks on a wardrobe and their outfit changes)
--[Only works on white-label deployment]

thisGameObject = Space.Host.ExecutingObject

OnClick = function()
Space.Scene.PlayerAvatar.LoadOutfit(2662469)
end

thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip = "Put on your favourite suit"
thisGameObject.Clickable.OnClick(OnClick)
Space.Scene.PlayerAvatar.ResetOutfit()
--Clicking this object will reset player avatar's outfit
thisObject = Space.Host.ExecutingObject
thisPlayer = Space.Scene.PlayerAvatar

OnClick = function()
thisPlayer.ResetOutfit() 
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClick)
local avatar=Space.Scene.PlayerAvatar
avatar.Register("MyName","MyPassword","MyEmail",false,function ()
    Space.Log("Success!")
end,function ()
    Space.Log("OnError!!")
end)
local avatar=Space.Scene.PlayerAvatar
avatar.ResetOutfitToTemplate(10001)
--Clicking this object will reset player avatar's outfit to a specific template.
thisObject = Space.Host.ExecutingObject
thisPlayer = Space.Scene.PlayerAvatar

OnClick = function()
thisPlayer.ResetOutfitToTemplate(10001)
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClick)
-- Humanoid models only. Pass a UnityEngine.HumanBodyBones name.
local bone = Space.Scene.PlayerAvatar.FindBone("LeftShoulder")
Space.Log(bone.Name) -- Prints the bone name of the corresponding search parameter; on default avatars, prints "LeftShoulder"
--[[
UnityEngine.HumanBodyBones values

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
]]
 --this script will set your avatar's "right hand" as parent of this object
--this way this object will be a child of your right hand and therefore move with it
--(Example: clicking on a gun to equip it)


thisGameObject = Space.Host.ExecutingObject

OnClick = function()

RightHand = Space.Scene.PlayerAvatar.FindBone("RightHand")
thisGameObject.SetParent(RightHand)
thisGameObject.LocalPosition = Vector.New(0,0,0) -- resetting position to match hand

end

thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip="Click to Equip "
thisGameObject.Clickable.OnClick(OnClick) 
Space.Scene.PlayerAvatar.Teleport("MyLandMark")
--or
Space.Scene.PlayerAvatar.Teleport( Vector.New(0,0,0) )
--or
Space.Scene.PlayerAvatar.Teleport( Vector.New(0,0,0), Quaternion.New(0,0,0) )
--or
Space.Scene.PlayerAvatar.Teleport( 5432342)
--or
Space.Scene.PlayerAvatar.Teleport( 5432342, Vector.New(0,0,0), Quaternion.New(0,0,0) )
--the below script teleports player to a specific landmark
--if they click the object containing it
--(Example: A region promotional/advertisement sign)
--[You need a landmark in the scene with name "Fashion Section Landmark"

thisGameObject = Space.Host.ExecutingObject

OnClick = function()
Space.Scene.PlayerAvatar.Teleport("Fashion Section Landmark")
end

thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip = "Click me to go to the fashion section!"
thisGameObject.Clickable.OnClick(OnClick)
avatar=Space.Scene.PlayerAvatar
pos=avatar.FindBone("Chest").WorldPosition
avatar.SetIKGoal("Chest",false,0,pos,true,20,Quaternion.Euler(0,60,0))
avatar=Space.Scene.PlayerAvatar
pos=avatar.FindBone("Chest").WorldPosition
avatar.SetIKGoal("Chest",false,0,pos,true,20,Quaternion.Euler(0,60,0))
Space.Host.InvokeDelayed(function ()
    avatar.ClearIKGoal("Chest")
end,5)
-- will clear after 5 seconds.
Space.Scene.PlayerAvatar.PlayCustomAnimation(Space.Resources[1])
 --the below script makes the player Play/Stop a custom animation when clicking this object
--(Example: Dance Machine )
--[Required: Place an animation in the first "Resource" in the scripting runtime]

thisGameObject = Space.Host.ExecutingObject
isDancing = 0


OnClick = function()

  if isDancing == 0 then
    Space.Scene.PlayerAvatar.PlayCustomAnimation(Space.Resources[1])
    isDancing = 1
  elseif isDancing == 1 then
    Space.Scene.PlayerAvatar.StopCustomAnimation()
    isDancing = 0
  end

end

thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip = "Click to Start/Stop dancing"
thisGameObject.Clickable.OnClick(OnClick)   
avatar=Space.Scene.PlayerAvatar
avatar.PlayCustomAnimation(Space.Resources[1])
avatar.StopCustomAnimation()
 --the below script makes the player Play/Stop a custom animation when clicking this object
--(Example: Dance Machine )
--[Required: Place an animation in the first "Resource" in the scripting runtime]

thisGameObject = Space.Host.ExecutingObject
isDancing = 0


OnClick = function()

  if isDancing == 0 then
    Space.Scene.PlayerAvatar.PlayCustomAnimation(Space.Resources[1])
    isDancing = 1
  elseif isDancing == 1 then
    Space.Scene.PlayerAvatar.StopCustomAnimation()
    isDancing = 0
  end

end

thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip = "Click to Start/Stop dancing"
thisGameObject.Clickable.OnClick(OnClick)   
local avatar=Space.Scene.PlayerAvatar
avatar.OnAvatarReload(function ()
    Space.Log(avatar.OutfitID)
end)
--this script ensures the avatar is still animating after their avatar gets reloaded
thisPlayer = Space.Scene.PlayerAvatar
theAnimation = Space.GetResource("The Animation") --add animation to resources in Scripting Runtime
wasAnimated = true --you'll need to set this according to the situation, its true now for example's sake


ResetDance = function()
 if wasAnimated then
  thisPlayer.PlayCustomAnimation(theAnimation)
 end

end
thisPlayer.OnAvatarReload(ResetDance)
Space.Scene.PlayerAvatar.SynchroniseState()
Space.Scene.PlayerAvatar.StartFly()
--the below script teleports the player to a sky location after he clicks
--but then immediately puts the character in fly mode so they don't fall back down
--(Example: Sky exhibit)

thisGameObject = Space.Host.ExecutingObject

OnClick = function()
Space.Scene.PlayerAvatar.Teleport(Vector.New(0,10,0))
Space.Scene.PlayerAvatar.StartFly()
end

thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip = "Click me to view our sky exhibit!"
thisGameObject.Clickable.OnClick(OnClick) 
Space.Scene.PlayerAvatar.EndFly()
--the below script teleports a player flying in the sky back to the ground
--and then ends fly mode by switching to Idle so they remain standing
--(Example: Going back down to ground from Sky exhibit)

thisGameObject = Space.Host.ExecutingObject

OnClick = function()
Space.Scene.PlayerAvatar.Teleport(Vector.New(0,0,0))
Space.Scene.PlayerAvatar.EndFly()
end

thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip = "Click me to go back to the ground!"
thisGameObject.Clickable.OnClick(OnClick) 
avatar=Space.Scene.PlayerAvatar
Space.Log(avatar.BlockJump)
avatar.OnAvatarSkeletonReload(function ()
    Space.Log(avatar.OutfitID)
end)
--this script ensures the avatar is still animating after their avatar's skeleton gets reloaded
thisPlayer = Space.Scene.PlayerAvatar
theAnimation = Space.GetResource("The Animation") --add animation to resources in Scripting Runtime
wasAnimated = true --you'll need to set this according to the situation, its true now for example's sake


ResetDance = function()
 if wasAnimated then
  thisPlayer.PlayCustomAnimation(theAnimation)
 end

end
thisPlayer.OnAvatarSkeletonReload(ResetDance)
timeUntilNextEvent = Space.Scene.PlayerAvatar.TeleportToNextEvent()
--or
timeUntilNextEvent = Space.Scene.PlayerAvatar.TeleportToNextEvent(500)
playerUsername = Space.Scene.PlayerAvatar.Username
 --this script, once clicked, will get all avatars in the scene
--and print their Username(including self)
--(Example: scoreboards/radars/scanners/game machines)

thisGameObject = Space.Host.ExecutingObject

OnClick = function()
allAvatars = Space.Scene.AllAvatars

        for var=1, #allAvatars do
    local Username = allAvatars[var].Username
     Space.Log("Username: " .. Username)
        end

end

 
thisGameObject.AddClickable() 
thisGameObject.Clickable.Tooltip = "Click to print all avatars' Username"
thisGameObject.Clickable.OnClick(OnClick) 
playerDisplayName =  Space.Scene.PlayerAvatar.DisplayName
playerTitle = Space.Scene.PlayerAvatar.Title
 --this script, once clicked, will get all avatars in the scene
--and print their Title and Username(including self)

thisGameObject = Space.Host.ExecutingObject

OnClick = function()
allAvatars = Space.Scene.AllAvatars

        for var=1, #allAvatars do
    local Username = allAvatars[var].Username
    local Title = allAvatars[var].Title
     Space.Log(Title .. " " .. Username)
        end

end

 
thisGameObject.AddClickable() 
thisGameObject.Clickable.Tooltip = "Click to print all avatars' Titles and Username"
thisGameObject.Clickable.OnClick(OnClick)
playerJobTitle = Space.Scene.PlayerAvatar.OrgTitle
playerCompanyName = Space.Scene.PlayerAvatar.OrgName
playerID = Space.Scene.PlayerAvatar.ID
--this script, once clicked, will get all avatars in the scene
--and print their ID(including self)
--(Example: scoreboards/radars/scanners/game machines)

thisGameObject = Space.Host.ExecutingObject

OnClick = function()
allAvatars = Space.Scene.AllAvatars

        for var=1, #allAvatars do
    local ID = allAvatars[var].ID
     Space.Log("ID: " .. ID)
        end

end

 
thisGameObject.AddClickable() 
thisGameObject.Clickable.Tooltip = "Click to print all avatars' ID"
thisGameObject.Clickable.OnClick(OnClick) 
isAttached = Space.Scene.PlayerAvatar.IsAttached
Space.Scene.PlayerAvatar.MovementSpeed = 20
 --the below script makes the object give the player triple movement speed
--once it's clicked, and then returns them to original speed after 10 seconds
--(Example: Triple Speed Powerup (avatar running race))

thisGameObject = Space.Host.ExecutingObject

TripleSpeedCoroutine = function()
local originalSpeed = Space.Scene.PlayerAvatar.MovementSpeed
Space.Scene.PlayerAvatar.MovementSpeed = originalSpeed * 3
coroutine.yield(10)
Space.Scene.PlayerAvatar.MovementSpeed = originalSpeed
  
end


OnClick = function()
Space.Host.StartCoroutine(TripleSpeedCoroutine)
end

thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip = "Triple Speed Powerup!"
thisGameObject.Clickable.OnClick(OnClick)  
Space.Scene.PlayerAvatar.JumpHeight = 20
 --the below script makes the object give the player triple jump height
--once it's clicked, and then returns them to original jump height after 10 seconds
--(Example: Triple Jump Height Powerup )

thisGameObject = Space.Host.ExecutingObject
originalJumpHeight = Space.Scene.PlayerAvatar.JumpHeight

TripleJumpHeightCoroutine = function()
Space.Scene.PlayerAvatar.JumpHeight = originalJumpHeight * 3
coroutine.yield(10)
Space.Scene.PlayerAvatar.JumpHeight = originalJumpHeight
end


OnClick = function()
Space.Host.StartCoroutine(TripleJumpHeightCoroutine)
end

thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip = "Triple JumpHeight Powerup!"
thisGameObject.Clickable.OnClick(OnClick)  
isGuest = Space.Scene.PlayerAvatar.Guest
--this script will make this object non-clickable for guest players

thisObject = Space.Host.ExecutingObject
thisPlayer = Space.Scene.PlayerAvatar

OnClick = function()
Space.Log("Do Something")
end

if not thisPlayer.Guest then --if player is not guest
thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClick)
end
avOutfit = Space.Scene.PlayerAvatar.OutfitID
isLoaded = Space.Scene.PlayerAvatar.Loaded
--this script will wait for a joining avatar to load first before making it play an animation
--(otherwise that animation may be reset if played before load is complete)

NewJoinAnimation = Space.GetResource("The Animation")

OnPlayerJoin = function(NewAvatar)
  
     Space.Host.StartCoroutine(function()
      
      while not NewAvatar.Loaded do coroutine.yield(0) end --makes it wait
 Space.Log("yes")     
      NewAvatar.PlayCustomAnimation(NewJoinAnimation) --at this point Loaded is True
      end)
      

end


Space.Scene.OnPlayerJoin(OnPlayerJoin)
playerGender = Space.Scene.PlayerAvatar.Gender
lockObject = Space.Scene.PlayerAvatar.LockObject
avSkeleton = Space.Scene.PlayerAvatar.Skeleton
--clicking this object will replace your avatar's animator controller (found on the skeleton)
thisObject = Space.Host.ExecutingObject
thisPlayer = Space.Scene.PlayerAvatar

customController = Space.GetResource("animcont")


OnClick = function()
 thisPlayer.Skeleton.Animator.Controller = customController
end

thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClick)
Space.Scene.PlayerAvatar.BlockMovement = true
 --the below script makes this object a boundary area where any user entering it
--will be blocked from movement for 20 seconds, then the object will release controls and
--destroy itself after that
--(Example: freezing trap)
--[This object's collider needs to be set as IsTrigger (Please read about OnTriggerStart for troubleshooting)]

thisGameObject = Space.Host.ExecutingObject
FrozenTime = 0.0

OnTriggerStart = function(TriggerStarter)
  if TriggerStarter.Root.Avatar ~= nil then
    if TriggerStarter.Root.Avatar.Username == Space.Scene.PlayerAvatar.Username then
      Space.Scene.PlayerAvatar.BlockMovement = true
    end
  end
end

OnTriggerStay = function(TriggerStayer)
  if TriggerStayer.Root.Avatar ~= nil then
    if TriggerStayer.Root.Avatar.Username == Space.Scene.PlayerAvatar.Username then
      FrozenTime = FrozenTime + Space.DeltaTime
        if FrozenTime > 20 then
        Space.Scene.PlayerAvatar.BlockMovement = false
        thisGameObject.Destroy()
        end
    end
  end
end

thisGameObject.SubscribeToEvents()
thisGameObject.OnTriggerStart(OnTriggerStart)
thisGameObject.OnTriggerStay(OnTriggerStay)
Space.Scene.PlayerAvatar.BlockRun = true
--this script will block a player's run ability when entering trigger collider and release it when leaving
--[Requires this object to have a "Trigger" collider]

thisObject = Space.Host.ExecutingObject
thisPlayer = Space.Scene.PlayerAvatar

OTS = function(gameObject)
  if gameObject.Avatar ~= nil and thisPlayer == gameObject.Avatar then 
    thisPlayer.BlockRun = true
  end
end

OTE = function(gameObject)
  if gameObject.Avatar ~= nil and thisPlayer == gameObject.Avatar then
   thisPlayer.BlockRun = false
  end 
end

thisObject.OnTriggerStart(OTS)
thisObject.OnTriggerExit(OTE)
Space.Scene.PlayerAvatar.BlockFly = true
--this script will block a player's fly ability when entering trigger collider and release it when leaving
--[Requires this object to have a "Trigger" collider]

thisObject = Space.Host.ExecutingObject
thisPlayer = Space.Scene.PlayerAvatar

OTS = function(gameObject)
  if gameObject.Avatar ~= nil and thisPlayer == gameObject.Avatar then 
    thisPlayer.BlockFly = true
  end
end

OTE = function(gameObject)
  if gameObject.Avatar ~= nil and thisPlayer == gameObject.Avatar then
   thisPlayer.BlockFly = false
  end 
end

thisObject.OnTriggerStart(OTS)
thisObject.OnTriggerExit(OTE)
Space.Scene.PlayerAvatar.BlockCrouch = true
--this script will block a player's crouch ability when entering trigger collider and release it when leaving
--[Requires this object to have a "Trigger" collider]

thisObject = Space.Host.ExecutingObject
thisPlayer = Space.Scene.PlayerAvatar

OTS = function(gameObject)
  if gameObject.Avatar ~= nil and thisPlayer == gameObject.Avatar then 
    thisPlayer.BlockCrouch = true
  end
end

OTE = function(gameObject)
  if gameObject.Avatar ~= nil and thisPlayer == gameObject.Avatar then
   thisPlayer.BlockCrouch = false
  end 
end

thisObject.OnTriggerStart(OTS)
thisObject.OnTriggerExit(OTE)
Space.Scene.PlayerAvatar.BlockJump = true
--this script will block a player's jump ability when entering trigger collider and release it when leaving
--[Requires this object to have a "Trigger" collider]

thisObject = Space.Host.ExecutingObject
thisPlayer = Space.Scene.PlayerAvatar

OTS = function(gameObject)
  if gameObject.Avatar ~= nil and thisPlayer == gameObject.Avatar then 
    thisPlayer.BlockJump= true
  end
end

OTE = function(gameObject)
  if gameObject.Avatar ~= nil and thisPlayer == gameObject.Avatar then
   thisPlayer.BlockJump= false
  end 
end

thisObject.OnTriggerStart(OTS)
thisObject.OnTriggerExit(OTE)
isGrounded = Space.Scene.PlayerAvatar.IsGrounded
playerObject = Space.Scene.PlayerAvatar.GameObject
--Clicking this object will teleport you 2 units forward and make you face the opposite way

thisObject = Space.Host.ExecutingObject
thisPlayer = Space.Scene.PlayerAvatar


OnClick = function()
local targetPos = thisPlayer.GameObject.WorldPosition + (thisPlayer.GameObject.Forward * 2) 
local targetRot = thisPlayer.GameObject.WorldRotation  *  Quaternion.AngleAxis(Vector.Up, 180)
thisPlayer.Teleport(targetPos, targetRot)
  
  
end

thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClick)

SMath

Index

Static Functions Index

Function Name

Static Attributes Index

Property Name

Static Functions

Random

static float Random ()

Returns a random float between 0 and 1 (inclusive)

Parameter
Type
Description

RandomRange

static float RandomRange (float min, float max)

Returns a random float between min and max (inclusive)

Parameter
Type
Description

RandomInteger

static int RandomInteger (int min, int max)

Returns a random float between min (inclusive) and max (exclusive)

Parameter
Type
Description

Abs

static float Abs (float v) static int Abs (int v)

Returns the absolute value of 'val'

Parameter
Type
Description

Acos

static float Acos (float v)

Returns the arc cosine value of 'val'

Parameter
Type
Description

Approximately

static bool Approximately (float a, float b)

True if the difference between a and b is less than epsilon

Parameter
Type
Description

Asin

static float Asin (float v)

Returns the arc sine value of 'val'

Parameter
Type
Description

Atan

static float Atan (float v)

Returns the arc tangent value of 'val'

Parameter
Type
Description

Atan2

static float Atan2 (float y, float x)

Returns the arc tangent of y/x

Parameter
Type
Description

Ceil

static int Ceil (float v)

Returns the ceil value of 'val' as an integer

Parameter
Type
Description

Clamp

static float Clamp (float v, float min, float max)

Clamps val between min and max, and returns the result

Parameter
Type
Description

Clamp01

static float Clamp01 (float v)

Clamps val between 0 and 1, and returns the result

Parameter
Type
Description

ClosestPowerOfTwo

static int ClosestPowerOfTwo (int v)

Returns the closest power of two to val

Parameter
Type
Description

Cos

static float Cos (float v)

Returns the cosine of val

Parameter
Type
Description

DeltaAngle

static float DeltaAngle (float current, float target)

Returns the difference in degrees between two values (e.g. 350' and 17' returns 27')

Parameter
Type
Description

Exp

static float Exp (float v)

Returns e raised to val power.

Parameter
Type
Description

Floor

static int Floor (float v)

Returns floor of val, converted to an int

Parameter
Type
Description

GammaToLinearSpace

static float GammaToLinearSpace (float v)

Converts a colour value from Gamma to Linear Space (Pow 2.2)

Parameter
Type
Description

InverseLerp

static float InverseLerp (float a, float b, float value)

Returns the percentage between a and b that 'val' is on a line (opposite of Lerp)

Parameter
Type
Description

IsPowerOfTwo

static bool IsPowerOfTwo (int v)

Returns true if val is a power of two

Parameter
Type
Description

Lerp

static float Lerp (float a, float b, float v)

Interpolates between 'a' and 'b' based on 'val', assuming 'val' is between 0 and 1

Parameter
Type
Description

LerpAngle

static float LerpAngle (float a, float b, float v)

Interpolates between angles 'a' and 'b' based on 'val', assuming 'val' is between 0 and 1

Parameter
Type
Description

LerpUnclamped

static float LerpUnclamped (float a, float b, float v)

Interpolates between 'a' and 'b' based on 'val', assuming 'val' is between 0 and 1, but unbounded (allowing higher/lower values)

Parameter
Type
Description

LinearToGammaSpace

static float LinearToGammaSpace (float v)

Converts a colour value from Linear to Gamma Space (Pow 1/2.2)

Parameter
Type
Description

Log

static float Log (float v) static float Log (float v, float p)

Returns the natural logarithm for 'val'

Parameter
Type
Description

Log10

static float Log10 (float v)

Returns the Log10 value for 'val'

Parameter
Type
Description

Max

static float Max (float a, float b)

Returns higher of 'a' or 'b'

Parameter
Type
Description

Min

static float Min (float a, float b)

Returns lower of 'a' or 'b'

Parameter
Type
Description

MoveTowards

static float MoveTowards (float value, float target, float delta)

Move value to target, but by no more than delta

Parameter
Type
Description

MoveTowardsAngle

static float MoveTowardsAngle (float value, float target, float delta)

Move angle value to target, but by no more than delta

Parameter
Type
Description

NextPowerOfTwo

static int NextPowerOfTwo (int v)

Return the next power of two larger or equal to val

Parameter
Type
Description

PerlinNoise

static float PerlinNoise (float x, float y)

Return 2D Perlin noise for coordinates x and y

Parameter
Type
Description

PingPong

static float PingPong (float t, float length)

Return a value between 0 and length that oscillates upwards and back based on the position of 'val'

Parameter
Type
Description

Pow

static float Pow (float value, float pow)

Return x raised to y power

Parameter
Type
Description

Repeat

static float Repeat (float value, float length)

Return a value between 0 and length that returns to 0 after exceeding length based on 'val'

Parameter
Type
Description

Round

static int Round (float value)

Returns the nearest integer value to val

Parameter
Type
Description

Sign

static float Sign (float value)

Returns either 1 or -1 based on the sign of 'val'

Parameter
Type
Description

Sin

static float Sin (float value)

Returns the sine of val

Parameter
Type
Description

SmoothStep

static float SmoothStep (float from, float to, float t)

Similar to Lerp but moves slowly closer to the edges ('Spherical Lerp')

Parameter
Type
Description

Sqrt

static float Sqrt (float value)

Returns the square root of val

Parameter
Type
Description

Tan

static float Tan (float value)

Returns the tangent value of 'val'

Parameter
Type
Description

Static Attributes

Pi

static readonly float Pi = 3.14159265358979f

Returns the constant value of Π.

static int (int v)

static float (float v)

static float (float current, float target)

static float (float v)

static int (float v)

static float (float v)

static float (float a, float b, float value)

static bool (int v)

static float (float a, float b, float v)

static float (float a, float b, float v)

static float (float a, float b, float v)

static float (float v)

static float (float v) static float (float v, float p)

static float (float v)

static float (float a, float b)

static float (float a, float b)

static float (float value, float target, float delta)

static float (float value, float target, float delta)

static int (int v)

static float (float x, float y)

static float (float t, float length)

static float (float value, float pow)

static float (float value, float length)

static int (float value)

static float (float value)

static float (float value)

static float (float from, float to, float t)

static float (float value)

static float (float value)

static float Random ()

static float RandomRange (float min, float max)

static int RandomInteger (int min, int max)

static float Abs (float v) static int Abs (int v)

static float Acos (float v)

static bool Approximately (float a, float b)

static float Asin (float v)

static float Atan (float v)

static float Atan2 (float y, float x)

static int Ceil (float v)

static float Clamp (float v, float min, float max)

static readonly float Pi****

static float (float v)

local randomNumber = Space.Math.Random();
Space.Log(randomNumber);
-- prints 0.689094245433807
local min = 100.0;
local max = 500.0;
local randomNumber = Space.Math.RandomRange(min, max );
Space.Log(randomNumber);
-- prints 0206.659149169922
local min = 50;
local max = 75;
local randomInteger = Space.Math.RandomInteger(min, max);
Space.Log(randomInteger);
-- prints 52
local value = -4.2
local absoluteNum = Space.Math.Abs(value);
Space.Log(absoluteNum);
-- prints 4 [BUG] should be 4.2
local value = 0.5;
local arcCosine = Space.Math.Acos(value);
Space.Log(arcCosine);
-- prints 1.04719758033752 (radians) which is 60 degrees
local a = 5.0;
local b = 5;
local approx1 = Space.Math.Approximately(a, b);
Space.Log(approx1);
-- prints true

local a = 5.01;
local b = 5.0;
local approx2 = Space.Math.Approximately(a, b);
Space.Log(approx2);
-- prints false

local a = 5.01;
local b = 5.0;
local approx3 = Space.Math.Approximately(a, b);
Space.Log(approx3);
-- prints false
local value = 0.5;
local arcSine = Space.Math.Asin(value);
Space.Log(arcSine);
-- prints 0.523598790168762 (radians) which is 30 degrees
local value = 1.732050808;
local arcTangent = Space.Math.Atan(value);
Space.Log(arcTangent);
-- prints 1.04719758033752 (radians) which is 60 degrees
local x = 0.5;
local y = 0.5;
local arcTangent = Space.Math.Atan2(y, x);
Space.Log(arcTangent);
-- prints 0.785398185253143
Space.Log(Space.Math.Ceil(4.0));
-- prints 4

Space.Log(Space.Math.Ceil(4.2));
-- prints 5

Space.Log(Space.Math.Ceil(-4.2));
-- prints -4
local value = 100.0;
local min = 20.0;
local max = 82.0;

local clampedValue = Space.Math.Clamp(value, min, max);
Space.Log(clampedValue);
-- prints 82
local value = -1.0;

local clampedValue = Space.Math.Clamp01(value);
Space.Log(clampedValue);
-- prints 0
local value = 33;

local powerOfTwo = Space.Math.ClosestPowerOfTwo(value);
Space.Log(powerOfTwo);
-- prints 32
local angle = 1.04719758033752; -- converts to 60 degrees
local cosine = Space.Math.Cos(angle);
Space.Log(cosine);
-- prints 0.499999970197678

local angle2 = Space.Math.Pi/3; -- converts to 60 degrees
local cosine2 = Space.Math.Cos(angle2);
Space.Log(cosine2);
-- prints 0.499999970197678
Space.Log(Space.Math.DeltaAngle(350.0, 17.0));
-- prints 27
Space.Log(Space.Math.Exp(3.0));
-- prints 20.0855369567871
Space.Log(Space.Math.Floor(4.0));
-- prints 4

Space.Log(Space.Math.Floor(4.2));
-- prints 4

Space.Log(Space.Math.Floor(-4.2));
-- prints -5
Space.Log(Space.Math.GammaToLinearSpace(0.5));
-- prints 0.214041143655777
local sliderStart = 0.0;
local sliderStop = 100.0;
local currentSliderPos = 75.0;

local percentage = Space.Math.InverseLerp(sliderStart, sliderStop, currentSliderPos);
Space.Log(percentage);
-- prints 0.75
Space.Log(Space.Math.IsPowerOfTwo(55));
-- prints False

Space.Log(Space.Math.IsPowerOfTwo(32));
-- prints True
local sliderStart = 0.0;
local sliderStop = 100.0;
local percentage = 0.75;

local currentSliderPos = Space.Math.Lerp(sliderStart, sliderStop, percentage);
Space.Log(currentSliderPos);
-- prints 75
local sliderStartAngle = 0.0;
local sliderStopAngle = Space.Math.Pi;-- 180 degrees
local percentage = 0.50;

local currentSliderPos = Space.Math.LerpAngle(sliderStartAngle, sliderStopAngle, percentage);
Space.Log(currentSliderPos);
-- prints 1.57079637050629 (90 degrees)
local sliderStart = 0.0;
local sliderStop = 100.0;
local percentage = 2.0;

local currentSliderPos = Space.Math.LerpUnclamped(sliderStart, sliderStop, percentage);
Space.Log(currentSliderPos);
-- prints 200
Space.Log(Space.Math.LinearToGammaSpace(0.214041143655777));
-- prints 0.5
Space.Log(Space.Math.Log(30.0));
-- prints 3.40119743347168

Space.Log(Space.Math.Log(4.0, 2.0));
-- prints 2
Space.Log(Space.Math.Log10(100.0));
-- prints 2
Space.Log(Space.Math.Max(20.0, 100.0));
-- prints 100
Space.Log(Space.Math.Min(20.0, 100.0));
-- prints 20
local sliderStart = 5.0;
local sliderStop = 10.0;
local deltaChange = 1.0;

local currentSliderPos = Space.Math.MoveTowards(sliderStart, sliderStop, deltaChange);
Space.Log(currentSliderPos);
-- prints 6 (moves forward 1)


local sliderStart = 5.0;
local sliderStop = 10.0;
local deltaChange = 7.0;

local currentSliderPos = Space.Math.MoveTowards(sliderStart, sliderStop, deltaChange);
Space.Log(currentSliderPos); -- prints 10 (caps out at at the target value)

-- NOTE: Use negative delta to move away from target.
local sliderStartAngle = Space.Math.Pi/2; -- 90 degrees
local sliderStopAngle = Space.Math.Pi; -- 180 degrees
local deltaChange = Space.Math.Pi/6; -- 30 degrees

local currentSliderPos = Space.Math.MoveTowardsAngle(sliderStartAngle, sliderStopAngle, deltaChange);
Space.Log(currentSliderPos);
-- prints 2.09439516067505 (moves forward 30 degrees to 120 degrees)

-- NOTE: Add 180 degrees (Space.Math.Pi) to move away from target.
Space.Log(Space.Math.NextPowerOfTwo(16));
-- prints 16

Space.Log(Space.Math.NextPowerOfTwo(17));
-- prints 32
-- Lua Translation of Unity C# Documentation

local ball = Space.Host.ExecutingObject;
ball.SubscribeToEvents();

-- animates this object to move upwards on the y axis with slight random movement
local animateBall = function()
  local heightScale = 0.1; -- controls speed of movement
  local xScale = 1.0; -- shifts x position on perlin noise plane

  local height = heightScale * Space.Math.PerlinNoise(Space.Time * xScale, 0.0);
  local pos = ball.LocalPosition;
  pos.y = pos.y + height;
  ball.LocalPosition = pos;
  Space.Log(pos.y);
end

ball.OnUpdate(animateBall);

-- NOTE: If you need a guaranteed range of [0,1], make sure to clamp the value with Space.Math.Clamp01.
--[[ In this example, if you traced the output of Space.Math.PingPong(value, length),
the return values would cycle forward through the range [0,5] then cycle backwards through the range [5,0] in order. --]]

local ball = Space.Host.ExecutingObject;
local originalPos = ball.LocalPosition;
ball.SubscribeToEvents();

-- The ball object oscillates back and forth on the x-axis.
local animateBall = function()
  local value = Space.Time;
  local length = 5.0;

  local newPos = Vector.New(Space.Math.PingPong(value, length) + originalPos.x, originalPos.y, originalPos.z);
  ball.LocalPosition = newPos;
end

ball.OnUpdate(animateBall);
Space.Log(Space.Math.Pow(2, 4));
-- prints 16
--[[ In this example, if you traced the output of Space.Math.Repeat(value, length),
the return values would cycle forward through the range [0,5]. The cycle is repeated again from 0.--]]

local ball = Space.Host.ExecutingObject;
local originalPos = ball.LocalPosition;
ball.SubscribeToEvents();

-- The ball object moves forward on the x-axis.
-- Then, it repeats the same motion again from the beginning.
local animateBall = function()
  local value = Space.Time;
  local length = 5.0;

  local newPos = Vector.New(Space.Math.Repeat(value, length) + originalPos.x, originalPos.y, originalPos.z);
  ball.LocalPosition = newPos;
end

ball.OnUpdate(animateBall);
Space.Log(Space.Math.Round(4.0));
-- prints 4

Space.Log(Space.Math.Round(4.2));
-- prints 4

Space.Log(Space.Math.Round(4.5));
-- prints 4

Space.Log(Space.Math.Round(4.55));
-- prints 5

Space.Log(Space.Math.Round(4.8));
-- prints 5

Space.Log(Space.Math.Round(-4.2));
-- prints -4

Space.Log(Space.Math.Round(-4.8));

-- prints -5
Space.Log(Space.Math.Sign(4.2));
-- prints 1

Space.Log(Space.Math.Sign(-4.2));
-- prints -1
local angle = 1.04719758033752; -- converts to 60 degrees
local sine = Space.Math.Sin(angle);
Space.Log(sine);
-- prints 0.866025447845459

local angle2 = Space.Math.Pi/3; -- converts to 60 degrees
local sine2 = Space.Math.Sin(angle2);
Space.Log(sine2);
-- prints 0.866025447845459
-- Lua Translation of Unity C# Documentation

--[[ In this example, Space.Math.SmoothStep(min, max, time) returns values in the range [1,10] in order.
As values approach 10, the interpolation slows down. --]]

local ball = Space.Host.ExecutingObject;
local originalPos = ball.LocalPosition;
local min = 1.0;
local max = 10.0;
local duration = 5.0; --lower value to speed up; raise to slow down
local startTime;
ball.SubscribeToEvents();

local initStartTime = function()
  startTime = Space.Time;
end

-- The ball jumps to min + originalPos, then it moves towards
-- max + originalPos while slowing down at the end.
local animateBall = function()
  local time = (Space.Time - startTime) / duration;
  local newPos = Vector.New(Space.Math.SmoothStep(min, max, time)
        + originalPos.x, originalPos.y, originalPos.z);
  ball.LocalPosition = newPos;
end

ball.OnStart(initStartTime);
ball.OnUpdate(animateBall);
Space.Log(Space.Math.Sqrt(16));
-- prints 4

Space.Log(Space.Math.Sqrt(-16));
-- prints NaN
local angle = 1.04719758033752; -- converts to 60 degrees
local tangent = Space.Math.Tan(angle);
Space.Log(tangent);
-- prints 1.73205089569092

local angle2 = Space.Math.Pi/3; -- converts to 60 degrees
local tangent2 = Space.Math.Tan(angle2);
Space.Log(tangent2);
-- prints 1.73205089569092
local angle = 1.04719758033752; -- converts to 60 degrees
local tangent = Space.Math.Tan(angle);
Space.Log(tangent);
-- prints 1.73205089569092

local angle2 = Space.Math.Pi/3; -- converts to 60 degrees
local tangent2 = Space.Math.Tan(angle2);
Space.Log(tangent2);
-- prints 1.73205089569092
local angle = 1.04719758033752; -- converts to 60 degrees
local tangent = Space.Math.Tan(angle);
Space.Log(tangent);
-- prints 1.73205089569092

local angle2 = Space.Math.Pi/3; -- converts to 60 degrees
local tangent2 = Space.Math.Tan(angle2);
Space.Log(tangent2);
-- prints 1.73205089569092
pi = Space.Math.Pi
Clamp01
ClosestPowerOfTwo
Cos
DeltaAngle
Exp
Floor
GammaToLinearSpace
InverseLerp
IsPowerOfTwo
Lerp
LerpAngle
LerpUnclamped
LinearToGammaSpace
Log
Log
Log10
Max
Min
MoveTowards
MoveTowardsAngle
NextPowerOfTwo
PerlinNoise
PingPong
Pow
Repeat
Round
Sign
Sin
SmoothStep
Sqrt
Tan

SGameObject

Functions

SubscribeToEvents

void SubscribeToEvents ()

Causes this script to start listening to events on the object.

This function is now automatically called by events that require it

SetSiblingIndex

void SetSiblingIndex (int newIndex)

Sets the sibling index.

Use this to change the sibling index of the GameObject. If a GameObject shares a parent with other GameObjects and are on the same level (i.e. they share the same direct parent), these GameObjects are known as siblings. The sibling index shows where each GameObject sits in this sibling hierarchy.

Use SetSiblingIndex to change the GameObject’s place in this hierarchy. When the sibling index of a GameObject is changed, its order in the Hierarchy window will also change.

Parameter
Type
Description

SetAsFirstSibling

void SetAsFirstSibling ()

This GameObject becomes the first Sibling

SetAsLastSibling

void SetAsLastSibling ()

This GameObject becomes the last Sibling

Duplicate

SGameObject Duplicate ()

Copies the object and returns a reference to the copy. Equivalent to calling Instantiate() in Unity

Instantiate

SGameObject Instantiate ()

Copy of Duplicate() for convenience

AddHingeJoint

AddHingeJoint ()

Adds a Hinge Joint component to this Game Object and returns its reference

AddLight

AddLight ()

Adds a Light component to the object.

AddAnimator

AddAnimator ()

Adds an Animator component to this Game Object and returns its reference

AddAudioSource

AddAudioSource ()

Adds an AudioSource component to the object.

AddClickable

AddClickable ()

Adds a Clickable component to the object.

GetScript

GetScript (string name)

Returns a Scripting Runtime component attached to this object by Component Name, or nil if none exist

Parameter
Type
Description

GetScriptsInChildren

List< > GetScriptsInChildren (string name, bool includeInactive=false)

Returns Scripting Runtime components attached to this object by Component Name or its children

Parameter
Type
Description

GetScriptInChildren

GetScriptInChildren (string name, bool includeInactive=false)

Returns a Scripting Runtime component attached to this object or its children by Component Name, or nil if none exist

Parameter
Type
Description

GetScriptInParent

GetScriptInParent (string name)

Returns a Scripting Runtime component attached to this object or its parents by Component Name, or nil if none exist

Parameter
Type
Description

GetEvents

GetEvents (string name)

Function Description

Parameter
Type
Description

GetAllEventsInChildren

List< > GetAllEventsInChildren (string name, bool includeInactive=false)

Function Description

Parameter
Type
Description

GetEventsInChildren

GetEventsInChildren (string name, bool includeInactive=false)

Function Description

Parameter
Type
Description

GetEventsInParent

GetEventsInParent (string name)

Function Description

Parameter
Type
Description

GetResources

GetResources (string name)

Function Description

Parameter
Type
Description

GetAllResourcesInChildren

List< > GetAllResourcesInChildren (string name, bool includeInactive=false)

Function Description

Parameter
Type
Description

GetResourcesInChildren

GetResourcesInChildren (string name, bool includeInactive=false)

Function Description

Parameter
Type
Description

GetResourcesInParent

GetResourcesInParent (string name)

Function Description

Parameter
Type
Description

GetData

GetData (string name)

Returns a Scripting Data component attached to this object by Component Name, or nil if none exist

Parameter
Type
Description

GetAllDataInChildren

List< > GetAllDataInChildren (string name, bool includeInactive=false)

Returns Scripting Data components attached to this object by Component Name or its children

Parameter
Type
Description

GetDataInChildren

GetDataInChildren (string name, bool includeInactive=false)

Returns a Scripting Data component attached to this object or its children by Component Name, or nil if none exist

Parameter
Type
Description

GetDataInParent

GetDataInParent (string name)

Returns a Scripting Data component attached to this object or its parents by Component Name, or nil if none exist

Parameter
Type
Description

AddRigidbody

AddRigidbody ()

Adds a Rigidbody component to the object.

AddNavMeshAgent

AddNavMeshAgent ()

Adds a NavMeshAgent component to the object.

AddSeat

AddSeat ()

Adds a Seat component to the object.

OnAwake

void OnAwake (Closure e)

Binds a event to the Awake() event.

Parameter
Type
Description

OnStart

void OnStart (Closure e)

Binds a event to the Start() event.

Parameter
Type
Description

OnEnable

void OnEnable (Closure e)

Binds a event to the OnEnable() event.

Parameter
Type
Description

OnDisable

void OnDisable (Closure e)

Binds a event to the OnDisable() event.

Parameter
Type
Description

OnFixedUpdate

void OnFixedUpdate (Closure e)

Binds a event to the OnFixedUpdate() event.

Parameter
Type
Description

OnLateUpdate

void OnLateUpdate (Closure e)

Binds a event to the OnLateUpdate() event.

Parameter
Type
Description

OnTriggerStart

void OnTriggerStart (Action< SGameObject > e) void OnTriggerStart (Closure e)

When a GameObject collides with another GameObject, Unity calls OnTriggerEnter.

OnTriggerEnter happens on the FixedUpdate function when two GameObjects collide. The Colliders involved are not always at the point of initial contact.

Note: Both GameObjects must contain a Collider component. One must have Collider.isTrigger enabled, and contain a Rigidbody. If both GameObjects have Collider.isTrigger enabled, no collision happens. The same applies when both GameObjects do not have a Rigidbody component.

Parameter
Type
Description

OnTriggerStay

void OnTriggerStay (Action< SGameObject > e) void OnTriggerStay (Closure e)

OnTriggerStay is called almost all the frames for every Collider other that is touching the trigger. The function is on the physics timer so it won't necessarily run every frame.

This message is sent to the trigger and the collider that touches the trigger. Note that trigger events are only sent if one of the colliders also has a rigidbody attached. Trigger events will be sent to disabled MonoBehaviours, to allow enabling Behaviours in response to collisions.

Parameter
Type
Description

OnTriggerExit

void OnTriggerExit (Action< SGameObject > e) void OnTriggerExit (Closure e)

OnTriggerExit is called when the Collider other has stopped touching the trigger.

This message is sent to the trigger and the Collider that touches the trigger. Notes: Trigger events are only sent if one of the Colliders also has a Rigidbody attached. Trigger events will be sent to disabled MonoBehaviours, to allow enabling Behaviours in response to collisions. OnTriggerExit occurs on the FixedUpdate after the Colliders have stopped touching. The Colliders involved are not guaranteed to be at the point of initial separation.

Parameter
Type
Description

OnCollisionEnter

void OnCollisionEnter (Action< SPhysicsHit > e) void OnCollisionEnter (Closure e)

OnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider.

In contrast to , OnCollisionEnter is passed the class and not a Collider (GameObject). The SPhysicsHit class contains information, for example, about contact points and impact velocity. Notes: Collision events are only sent if one of the colliders also has a non-kinematic rigidbody attached. Collision events will be sent to disabled MonoBehaviours, to allow enabling Behaviours in response to collisions.

Parameter
Type
Description

OnCollisionStay

void OnCollisionStay (Action< > e) void OnCollisionStay (Closure e)

OnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider.

In contrast to , OnCollisionStay is passed the class and not a Collider (GameObject). The class contains information about contact points, impact velocity etc. If you don't use collisionInfo in the function, leave out the collisionInfo parameter as this avoids unneccessary calculations. Notes: Collision events are only sent if one of the colliders also has a non-kinematic rigidbody attached. Collision events will be sent to disabled MonoBehaviours, to allow enabling Behaviours in response to collisions. Collision stay events are not sent for sleeping Rigidbodies.

Parameter
Type
Description

OnCollisionExit

void OnCollisionExit (Action< > e) void OnCollisionExit (Closure e)

OnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider.

In contrast to OnTriggerExit, OnCollisionExit is passed the SPhysicsHit class and not a Collider. The SPhysicsHit class contains information about contact points, impact velocity etc. If you don't use collisionInfo in the function, leave out the collisionInfo parameter as this avoids unneccessary calculations. Notes: Collision events are only sent if one of the colliders also has a non-kinematic rigidbody attached. Collision events will be sent to disabled MonoBehaviours, to allow enabling Behaviours in response to collisions.

Parameter
Type
Description

OnParticleCollision

void OnParticleCollision (Action< SGameObject > e) void OnParticleCollision (Closure e)

OnParticleCollision is called when a particle hits a Collider.

This can be used to apply damage to a GameObject when hit by particles.

This message is sent to scripts attached to Particle Systems and to the Collider that was hit.

When OnParticleCollision is invoked from a script attached to a GameObject with a Collider, the GameObject parameter represents the ParticleSystem. The Collider receives at most one message per Particle System that collided with it in any given frame even when the Particle System struck the Collider with multiple particles in the current frame.

When OnParticleCollision is invoked from a script attached to a ParticleSystem, the GameObject parameter represents a GameObject with an attached Collider struck by the ParticleSystem. The ParticleSystem receives at most one message per Collider that is struck.

Messages are only sent if you enable Send Collision Messages in the Inspector of the Particle System Collision module.

The OnParticleCollision can be a co-routine. Simply use the yield statement in the function.

Parameter
Type
Description

OnParticleTrigger

void OnParticleTrigger (Closure e)

Binds a new event handler for the OnParticleTrigger event.

OnParticleTrigger event is called when any particles in a Particle System meet the conditions in the trigger module.

This can be used to kill or modify particles that are inside or outside a collision volume.

Parameter
Type
Description

OnUpdate

void OnUpdate (Closure e)

Binds a event to the OnUpdate() event.

Parameter
Type
Description

OnMouseDown

void OnMouseDown (Closure e)

Binds a event to the OnMouseDown() event.

Parameter
Type
Description

OnApplicationQuit

void OnApplicationQuit (Closure e)

Binds a new event handler for the On Application Quit event

Parameter
Type
Description

CompareTag

bool CompareTag (string tag)

Function Description

Parameter
Type
Description

SetParent

void SetParent (SGameObject other, bool worldPositionStays=true)

Make this GameObject the child of GameObject 'other'

Parameter
Type
Description

Find

SGameObject Find (string name)

Find and return a reference to GameObject with name 'name'

Parameter
Type
Description

FindInChildren

SGameObject FindInChildren (string name)

Find and return a reference to GameObject with name 'name' including children

Parameter
Type
Description

Destroy

void Destroy ()

Schedules this object for deletion at the end of the frame

GetComponent

SComponent GetComponent (string name)

Depreciated

Properties

Owner

long Owner get

Returns the GameObject's Owner

LocalID

int LocalID get

Returns the GameObject's Local ID

InventoryID

int InventoryID get

Return's the GameObject's InventoryID

HasStableID

bool HasStableID get

Returns true if GameObject has Stable ID

GlobalID

string? GlobalID get

Returns the global ID of the GameObject

Exists

bool Exists get

Does this object still exist in the scene (returns false if the object has been deleted via Destroy();)

HingeJoint

HingeJoint get

Returns a HingeJoint component attached to this object, or nil if none exist

Light

Light get

Returns a reference to a Light component on the object. Will return null if it does not exist.

ReflectionProbe

ReflectionProbe get

Returns a ReflectionProbe component attached to this object, or nil if none exist

LightInChild

LightInChildget

Returns a Light component attached to this object or its children, or nil if none exist

LightInParent

LightInParent get

Returns a Light component attached to this object or it's parent, or nil if none exist

Animator

Animator get

Returns a reference to a Animator component on the object. Will return null if it does not exist.

Animation

Animation get

Returns an Animation component attached to this object, or nil if none exist Animation is a legacy component and should not be confused with Animator

CanvasGroup

CanvasGroup get

Returns Canvas Group component attached to this object, or nil if none exist

Audio

Audio get

Returns a reference to a AudioSource component on the object. Will return null if it does not exist.

Floor

Floor get

Returns a RoomFloor component attached to this object, or nil if none exist

VoiceZone

VoiceZone get

Returns a VoiceZone component attached to this object, or nil if none exist

Browser

Browser get

Returns a reference to a BrowserSurface component on the object. Will return null if it does not exist.

Director

Director get

Returns a PlayableDirector component attached to this object, or nil if none exist

Renderer

Renderer get

Returns a reference to a Renderer component on the object. Will return null if it does not exist.

Vehicle

Vehicle get

Returns a Modular Vehicle component attached to this object, or nil if none exist

PostProcessVolume

PostProcessVolume get

Returns a Post Process Volume component attached to this object, or nil if none exist

Archimatix

SAXModel Archimatix get

Returns a Archimatix Model ("AXModel" component) - or Nil if nothing exists

Clickable

Clickable get

Returns a reference to a Clickable component on the object. Will return null if it does not exist.

EmbeddedVideo

EmbeddedVideo get

Returns an Embedded Video component attached to this object, or nil if none exist (may not work within editor)

Avatar

Avatar get

A reference to an Avatar component on the GameObject.

AvatarAppearance

AvatarAppearance get

Returns a AvatarAppearance component attached to this object, or nil if none exist

Script

Script get

Returns a Scripting Runtime component attached to this object, or nil if none exist

StateMachine

StateMachine get

Returns a State Machine component attached to this object, or nil if none exist

Networking

Networking get

Returns a Simple Networking component attached to this object, or nil if none exists

Events

Events get

Property Description

Resources

Resources get

Property Description

Data

Data get

Returns a Scripting Data component attached to this object, or nil if none exist

Rigidbody

Rigidbody get

Returns a reference to a Rigidbody component on the object. Will return null if it does not exist.

Collider

Collider get

Returns a reference to a Collider component on the object. Will return null if it does not exist.

BoxCollider

BoxCollider get

Returns a Box Collider component attached to this object, or nil if none exist

SphereCollider

SphereCollider get

Returns a Sphere Collider component attached to this object, or nil if none exist

CapsuleCollider

CapsuleCollider get

Returns a Capsule Collider component attached to this object, or nil if none exist

WheelCollider

WheelCollider get

Returns a WheelCollider component attached to this object, or nil if none exist

CharacterController

CharacterController get

Returns a Character Controller component attached to this object, or nil if none exist

AudioReactive

AudioReactive get

Returns the first Audio Reactive component attached to this object, or nil if none exist

AttachmentHelper

SAttachmentHelper AttachmentHelper get

Returns the first Attachment Helper component attached to this object, or nil if none exist

AudioReactiveAnimation

AudioReactiveAnimation get

Returns the first Audio Reactive Animation component attached to this object, or nil if none exist

AudioReactiveLight

AudioReactiveLight get

Returns the first Audio Reactive Light component attached to this object, or nil if none exist

AudioReactiveParticleSystem

AudioReactiveParticleSystem get

Returns the first Audio Reactive Particle System component attached to this object, or nil if none exist

AudioReactiveMaterial

AudioReactiveMaterial get

Returns the first Audio Reactive Material component attached to this object, or nil if none exist

AudioReactiveTransform

AudioReactiveTransform get

Returns the first Audio Reactive Transform component attached to this object, or nil if none exist

TrailRenderer

TrailRenderer get

Returns a Trail Renderer component attached to this object, or nil if none exist

LineRenderer

LineRenderer get

Returns a Line Renderer component attached to this object, or nil if none exist

UILayout

UILayout get

Returns a Renderer component attached to this object, or nil if none exist

UIToggle

UIToggle get

Returns a Unity uGUI Toggle component attached to this object, or nil if none exist

UIDropdown

UIDropdown get

Returns a Unity uGUI Dropdown component attached to this object, or nil if none exist

UIButton

UIButton get

Returns a Unity uGUI Dropdown component attached to this object, or nil if none exist

UIText

UIText get

Returns a reference to a UI.Text component on the object. Will return null if it does not exist.

UISlider

UISlider get

Returns a Unity uGUI Slider component attached to this object, or nil if none exist

UIScrollbar

UIScrollbar get

Returns a Unity uGUI Scrollbar component attached to this object, or nil if none exist

UICanvas

UICanvas get

Returns a Unity uGUI Canvas component attached to this object, or nil if none exist

UIImage

UIImage get

Returns a Unity uGUI Image component attached to this object, or nil if none exist

UIRawImage

UIRawImage get

Returns a Unity uGUI Text component attached to this object, or nil if none exist

UIInputField

UIInputField get

Returns a Unity uGUI Text component attached to this object, or nil if none exist

UIToolTipHint

UIToolTipHint get

Property Description

Camera

Camera get

Property Description

VirtualCamera

VirtualCamera get

Returns a VirtualCamera component attached to this object, or nil if none exists

Cloth

Cloth get

Returns a Cloth component attached to this object, or nil if none exists

MeshRenderer

MeshRenderer get

Returns a MeshRenderer component attached to this object, or nil if none exists

Furniture

Furniture get

Returns a Furniture component attached to this object, or nil if none exists

NavMeshAgent

NavMeshAgent get

Adds a NavMeshAgent component to the object.

NavMeshObstacle

NavMeshObstacle get

Returns a NavMeshObstacle component attached to this object, or nil if none exists

ParticleSystem

ParticleSystem get

Returns a ParticleSystem component attached to this object, or nil if none exists

RectTransform

RectTransform get

Returns a RectTransform component attached to this object, or nil if none exists

Seat

Seat get

Returns a reference to a Seat component on the object. Will return null if it does not exist.

SkinnedMeshRenderer

SkinnedMeshRenderer get

Returns a SkinnedMeshRenderer component attached to this object, or nil if none exists

Radio

Radio get

Returns a SceneBackgroundMusic component attached to this object, or nil if none exists

Terrain

Terrain get

Returns a Terrain component attached to this object, or nil if none exists

AnalyticsEvent

SAnalyticsEvent AnalyticsEvent get

Property Description

GraphicRaycaster

GraphicRaycaster get

Property Description

ContentSizeFitter

SContentSizeFitter ContentSizeFitter get

Property Description

Active

bool Active get set

Is this object Active in the scene

ActiveSelf

bool ActiveSelf get set

Returns true if GameObject is Active (even if it's parent is not active)

Layer

int Layer get set

Gets/Sets the object onto a particular layer (0-31)

Tag

string Tag get

Gets this objects Tag

Name

string Name get set

Gets/sets the name of this object

Moniker

string? Moniker get set

Property Description

Parent

Parent get set

Gets/sets the parent GameObject of this object. Assign nil/null to set this as the root.

Root

Root get

Gets the root of this object group - may be this object.

Children

[] Children get

Returns the list of direct children of this object.

WorldPosition

WorldPosition get set

Gets or sets the current position of this object relative to the scene

LocalPosition

LocalPosition get set

Gets or sets the current position of this object relative to the objects parent, taking into account local position/scale/rotation

WorldRotation

WorldRotation get set

Gets or sets the current rotation of this object relative to the scene

LocalRotation

LocalRotation get set

Gets or sets the current rotation of this object relative to the parent object

LocalScale

LocalScale get set

Gets or sets the current scale of this object relative to the parent

WorldScale

WorldScale get

Gets the current scale of this object relative to the scene

Forward

Forward get

Returns the forward direction vector of this game object (blue arrow)

Up

Up get

Returns the up direction vector of this game object (green arrow)

Right

Right get

Returns the right direction vector of this game object (red arrow)

EventCalendar

EventCalendar get

Returns an EventCalendar component attached to this object, or nil if none exists

name

string

SHingeJoint
SLight
SAnimator
SAudioSource
SClickable
SScriptingRuntime
SScriptingRuntime
SScriptingRuntime
SScriptingRuntime
SScriptingEvents
SScriptingEvents
SScriptingEvents
SScriptingEvents
SScriptingResources
SScriptingResources
SScriptingResources
SScriptingResources
SScriptingData
SScriptingData
SScriptingData
SScriptingData
SRigidbody
SNavMeshAgent
SSeat
OnTrigger
Start
SPhysicsHit
SPhysicsHit
OnTriggerStay
SPhysicsHit
SPhysicsHit
SPhysicsHit
SHingeJoint
SLight
SReflectionProbe
SLight
SLight
SAnimator
SAnimation
SCanvasGroup
SAudioSource
SRoomFloor
SVoiceZone
SBrowserSurface
SPlayableDirector
SRenderer
SModularVehicle
SPostProcessVolume
SClickable
SEmbeddedVideo
SAvatar
SAvatarAppearance
SScriptingRuntime
SStateMachine
SNetworking
SScriptingEvents
SScriptingResources
SScriptingData
SRigidbody
SCollider
SBoxCollider
SSphereCollider
SCapsuleCollider
SWheelCollider
SCharacterController
SAudioReactiveBase
SAudioReactiveAnimation
SAudioReactiveLight
SAudioReactiveParticleSystem
SAudioReactiveMaterial
SAudioReactiveTransform
STrailRenderer
SLineRenderer
SUILayout
SUIToggle
SUIDropdown
SUIButton
SUIText
SUISlider
SUIScrollbar
SUICanvas
SUIImage
SUIRawImage
SUIInputField
SUIToolTipHint
SCamera
SVirtualCamera
SCloth
SMeshRenderer
SFurniture
SNavMeshAgent
SNavMeshObstacle
SParticleSystem
SRectTransform
SSeat
SSkinnedMeshRenderer
SSceneBackgroundMusic
STerrain
SGraphicRaycaster
SGameObject
SGameObject
SGameObject
SVector
SVector
SQuaternion
SQuaternion
SVector
SVector
SVector
SVector
SVector
SEventCalendar
Space.Host.ExecutingObject.SubscribeToEvents()
Space.Host.ExecutingObject.SetSiblingIndex(2)
Space.Host.ExecutingObject.SetAsFirstSibling()
Space.Host.ExecutingObject.SetAsLastSibling()
local copy = Space.Host.ExecutingObject.Duplicate()
--this script will make this object, once clicked, duplicate itself, then the duplicate
--moves up and then duplicate itself again and the duplicate move down (total 3 vertically aligned)
--(Example: cells multiplying)


thisGameObject = Space.Host.ExecutingObject


OnClick = function()

local firstDuplicate = thisGameObject.Duplicate()
firstDuplicate.WorldPosition = firstDuplicate.WorldPosition + firstDuplicate.Up
local secondDuplicate = thisGameObject.Duplicate()
secondDuplicate.WorldPosition = secondDuplicate.WorldPosition - secondDuplicate.Up

end

thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip="Click to watch me multiply "
thisGameObject.Clickable.OnClick(OnClick)
NewGameObject = Space.Host.ExecutingObject.Instantiate()
--this script will make this object, once clicked, duplicate itself, then the duplicate
--moves up and then duplicate itself again and the duplicate move down (total 3 vertically aligned)
--(Example: cells multiplying)


thisGameObject = Space.Host.ExecutingObject


OnClick = function()

local firstDuplicate = thisGameObject.Instantiate()
firstDuplicate.WorldPosition = firstDuplicate.WorldPosition + firstDuplicate.Up
local secondDuplicate = thisGameObject.Instantiate()
secondDuplicate.WorldPosition = secondDuplicate.WorldPosition - secondDuplicate.Up

end

thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip="Click to watch me multiply "
thisGameObject.Clickable.OnClick(OnClick) 
NewHingeJoint = Space.Host.ExecutingObject.AddHingeJoint()
--clicking this object will add a Hinge Joint component to it at runtime

thisObject = Space.Host.ExecutingObject


OnClick = function()
HJ = thisObject.AddHingeJoint()
end



thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClick)
newLightComponent = Space.Host.ExecutingObject.AddLight()
NewAnimator = Space.Host.ExecutingObject.AddAnimator()
--clicking this object will add an animator to it and controller at runtime

thisObject = Space.Host.ExecutingObject
theResource = Space.GetResource("An Animator Controller") -- add controller to resources in Scripting Runtime


OnClick = function()
Animator = thisObject.AddAnimator()  
Animator.Controller = theResource
end



thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClick)
newAudioSourceComponent = Space.Host.ExecutingObject.AddAudioSource()
newClikcableComponent = Space.Host.ExecutingObject.AddClickable()
scriptingRuntime = Space.Host.ExecutingObject.GetScript("scriptingruntimecomponentname")
tableScriptsInChildren = Space.Host.ExecutingObject.GetScriptsInChildren("scriptingruntimecomponentname",true)
scriptingRuntimeInChildren = Space.Host.ExecutingObject.GetScriptInChildren("scriptingruntimecomponentname",true)
scriptingRuntimeInParent = Space.Host.ExecutingObject.GetScript("scriptingruntimecomponentname")
scriptingEvent = Space.Host.ExecutingObject.GetEvents('ScriptingEventsComponentName')
tableScriptingEvent = Space.Host.ExecutingObject.GetAllEventsInChildren
scriptingEvent = Space.Host.ExecutingObject.GetEventsInChildren('ScriptingEventsComponentName')
--or
scriptingEvent = Space.Host.ExecutingObject.GetEventsInChildren('ScriptingEventsComponentName', true)
scriptingEvent = Space.Host.ExecutingObject.GetEventsInParent('ScriptingEventsComponentName')
Space.Host.ExecutingObject.GetResources('ResourcesComponentName')
tableScriptingResources = Space.Host.ExecutingObject.GetAllResourcesInChildren('ScriptingResourcesComponentName')
--or
tableScriptingResources = Space.Host.ExecutingObject.GetAllResourcesInChildren('ScriptingResourcesComponentName', true)
tableScriptingResources = Space.Host.ExecutingObject.GetResourcesInChildren('ScriptingResourcesComponentName')
--or
tableScriptingResources = Space.Host.ExecutingObject.GetResourcesInChildren('ScriptingResourcesComponentName', true)
tableScriptingResources = Space.Host.ExecutingObject.GetResourcesInParent('ScriptingResourcesComponentName')
scriptingData = Space.Host.ExecutingObject.GetData("scriptingdatacomponentname")
tableScriptingDataInChildren = Space.Host.ExecutingObject.GetAllDataInChildren("scriptingdatacomponentname",true)
scriptingDataInChildren = Space.Host.ExecutingObject.GetDataInChildren("scriptingdatacomponentname",true)
scriptingDataInParent = Space.Host.ExecutingObject.GetDataInParent("scriptingdatacomponentname")
newRigibodyComponent = Space.Host.ExecutingObject.AddRigidbody()
newNavMeshAgentComponent =  Space.Host.ExecutingObject.AddNavMeshAgent()
newSeatComponent = Space.Host.ExecutingObject.AddSeat()
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnAwake(F)
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnStart(F)
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnEnable(F)
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnDisable(F)
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnFixedUpdate(F)
--this script will make this object move forward each physics frame
thisObject = Space.Host.ExecutingObject

OnFixedUpdate = function()
  
  thisObject.WorldPosition = thisObject.WorldPosition + (thisObject.Forward * 0.01 )
--unlike OnUpdate we did not multiply by Space.DeltaTime 
--because OnFixedUpdate executes at the same rate regardless
end


thisObject.OnFixedUpdate(OnFixedUpdate)
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnLateUpdate(F)
--this script will make this object move forward each frame
--but it will be last to move among other objects (read about OnLateUpdate)
--(example: camera movement)
thisObject = Space.Host.ExecutingObject

OnLateUpdate = function()
  
  thisObject.WorldPosition = thisObject.WorldPosition + (thisObject.Forward * 0.01 * Space.DeltaTime)
--we multipy by Space.DeltaTime so that it behaves the same for all players
--even though they have different FPS (frames per second)
end


thisObject.OnLateUpdate(OnLateUpdate)
this = Space.Host.ExecutingObject

OnTriggerStart  = function(SGameObject)
 Space.Log("Trigger Start")
end

this.OnTriggerStart (OnTriggerStart )
 --the below scipt makes this object a boundary area where flying gets blocked
--while player is in it and flying is allowed once player leaves it
--(Example: No fly zone)
--[This object's collider needs to be set as IsTrigger (Please read about OnTriggerStart for troubleshooting)]

thisGameObject = Space.Host.ExecutingObject

OnTriggerStart = function(TriggerStarter)
  if TriggerStarter.Root.Avatar ~= nil then
    if TriggerStarter.Root.Avatar.Username == Space.Scene.PlayerAvatar.Username then
      Space.Scene.PlayerAvatar.BlockFly = true
    end
  end
end


OnTriggerExit = function(TriggerExiter)
  if TriggerExiter.Root.Avatar ~= nil then
    if TriggerExiter.Root.Avatar.Username == Space.Scene.PlayerAvatar.Username then
      Space.Scene.PlayerAvatar.BlockFly = false
    end
  end
end

thisGameObject.OnTriggerStart(OnTriggerStart)
thisGameObject.OnTriggerExit(OnTriggerExit) 
this = Space.Host.ExecutingObject

OnTriggerStay  = function(SGameObject)
 Space.Log("Trigger Stay")
end

this.OnTriggerStay(OnTriggerStay)
--the below scipt makes this object a boundary area where any user entering it
--will be blocked from movement for 10 seconds, then the object will release controls and
--destry itself after that
--(Example: freezing trap)
--[This object's collider needs to be set as IsTrigger (Please read about OnTriggerStart for troubleshooting)]

thisGameObject = Space.Host.ExecutingObject
FrozenTime = 0.0

OnTriggerStart = function(TriggerStarter)
  if TriggerStarter.Root.Avatar ~= nil then
    if TriggerStarter.Root.Avatar.Username == Space.Scene.PlayerAvatar.Username then
      Space.Scene.PlayerAvatar.BlockMovement = true
    end
  end
end

OnTriggerStay = function(TriggerStayer)
  if TriggerStayer.Root.Avatar ~= nil then
    if TriggerStayer.Root.Avatar.Username == Space.Scene.PlayerAvatar.Username then
      FrozenTime = FrozenTime + Space.DeltaTime
        if FrozenTime > 20 then
        Space.Scene.PlayerAvatar.BlockMovement = false
        thisGameObject.Destroy()
        end
    end
  end
end

thisGameObject.OnTriggerStart(OnTriggerStart)
thisGameObject.OnTriggerStay(OnTriggerStay)
this = Space.Host.ExecutingObject

OnTriggerExit  = function(SGameObject)
 Space.Log("Trigger Stay")
end

this.OnTriggerExit(OnTriggerExit)
--the below scipt makes this object a boundary area where flying gets blocked
--while player is in it and flying is allowed once player leaves it
--(Example: No fly zone)
--[This object's collider needs to be set as IsTrigger (Please read about OnTriggerStart for troubleshooting)]

thisGameObject = Space.Host.ExecutingObject

OnTriggerStart = function(TriggerStarter)
  if TriggerStarter.Root.Avatar ~= nil then
    if TriggerStarter.Root.Avatar.Username == Space.Scene.PlayerAvatar.Username then
      Space.Scene.PlayerAvatar.BlockFly = true
    end
  end
end


OnTriggerExit = function(TriggerExiter)
  if TriggerExiter.Root.Avatar ~= nil then
    if TriggerExiter.Root.Avatar.Username == Space.Scene.PlayerAvatar.Username then
      Space.Scene.PlayerAvatar.BlockFly = false
    end
  end
end

thisGameObject.OnTriggerStart(OnTriggerStart)
thisGameObject.OnTriggerExit(OnTriggerExit)
this = Space.Host.ExecutingObject

OnCollisionEnter = function(SPhysicsHit)
 Space.Log("Collision Enter")
end

this.OnCollisionEnter(OnCollisionEnter)
 --this script will make this object delete itself if it collides with something
--(Example: grenade)
--[Make sure you add a rigibody to this object (read above about "collisions")


thisGameObject = Space.Host.ExecutingObject


OnCollisionEnter = function(SPhysicsHit)
 thisGameObject.Destroy()
end

thisGameObject.OnCollisionEnter(OnCollisionEnter) 
this = Space.Host.ExecutingObject

OnCollisionStay = function(SPhysicsHit)
 Space.Log("Collision Stay")
end

this.OnCollisionStay(OnCollisionStay)
  --this script will make this object delete itself if
 --it is being touched for around 10 seconds
--(Example: a flag being captured)
--[Make sure this object has collider/rigidbody (read above about "collisions" for troubleshooting)]


thisGameObject = Space.Host.ExecutingObject
touchedTime = 0.0

OnCollisionStay = function(SPhysicsHit)
  touchedTime = touchedTime + Space.DeltaTime
    if touchedTime > 25 then
   thisGameObject.Destroy()
   end
end

thisGameObject.OnCollisionStay(OnCollisionStay)  
this = Space.Host.ExecutingObject

OnCollisionExit = function(SPhysicsHit)
 Space.Log("Collision Exit")
end

this.OnCollisionExit(OnCollisionExit)
--this script will make this object destroy itself when an object 
--that collided with it exits the collission
--(Example: landmine)
--[Make sure you add a rigibody to this object (read above about "collisions")


thisGameObject = Space.Host.ExecutingObject


OnCollisionExit = function(SPhysicsHit)
 thisGameObject.Destroy()
end

thisGameObject.OnCollisionExit(OnCollisionExit)
this = Space.Host.ExecutingObject

OnParticleCollision = function(GameObject)
 Space.Log("Particle Collision")
end

this.OnParticleCollision(OnParticleCollision)
this = Space.Host.ExecutingObject

OnParticleTrigger = function(GameObject)
 Space.Log("Particle Trigger Event")
end

this.OnParticleTrigger(OnParticleTrigger)
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnUpdate(F)
--this script will make this object move forward each frame
thisObject = Space.Host.ExecutingObject

OnUpdate = function()
  
  thisObject.WorldPosition = thisObject.WorldPosition + (thisObject.Forward * 0.01 * Space.DeltaTime)
--we multipy by Space.DeltaTime so that it behaves the same for all players
--even though they have different FPS (frames per second)
end


thisObject.OnUpdate(OnUpdate)
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnMouseDown(F)
this = Space.Host.ExecutingObject

OnApplicationQuit = function()
 Space.Log("Application Quit")
end

this.OnApplicationQuit(OnApplicationQuit)
isSame = Space.Host.ExecutingObject.CompareTag('tagname')
Space.Host.ExecutingObject.SetParent(otherObjectReference,true)
--this script will set your avatar's "right hand" as parent of this object
--this way this object will be a child of your right hand and therefore move with it
--(Example: clicking on a gun to equip it)


thisGameObject = Space.Host.ExecutingObject

OnClick = function()

RightHand = Space.Scene.PlayerAvatar.FindBone("RightHand")
thisGameObject.SetParent(RightHand)
thisGameObject.LocalPosition = Vector.New(0,0,0) -- resetting position to match hand

end

thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip="Click to Equip "
thisGameObject.Clickable.OnClick(OnClick)
FoundObject = Space.Host.ExecutingObject.Find("GameObject Name")
FoundObjectInChildren = Space.Host.ExecutingObject.FindInChildren("GameObject Name")
Space.Host.ExecutingObject.Destroy()
Owner = Space.Host.ExecutingObject.Owner
LocalID = Space.Host.ExecutingObject.LocalID
InventoryID = Space.Host.ExecutingObject.InventoryID
HasStableID = Space.Host.ExecutingObject.HasStableID
GlobalID = Space.Host.ExecutingObject.GlobalID
doesExist = Space.Host.ExecutingObject.Exists
HingeJoint = Space.Host.ExecutingObject.HingeJoint
newLightComponent = Space.Host.ExecutingObject.Light
ReflectionProbe = Space.Host.ExecutingObject.ReflectionProbe
LightInChild = Space.Host.ExecutingObject.LightInChild
LightInParent = Space.Host.ExecutingObject.LightInParent
animatorComponent = Space.Host.ExecutingObject.Animator
Animation = Space.Host.ExecutingObject.Animation
CanvasGroup = Space.Host.ExecutingObject.CanvasGroup
newAudioComponent = Space.Host.ExecutingObject.Audio
Floor = Space.Host.ExecutingObject.Floor
VoiceZone = Space.Host.ExecutingObject.VoiceZone
newBrowserComponent = Space.Host.ExecutingObject.Browser
Director = Space.Host.ExecutingObject.Director
renderer = Space.Host.ExecutingObject.Renderer
Vehicle = Space.Host.ExecutingObject.Vehicle
PostProcessVolume = Space.Host.ExecutingObject.PostProcessVolume
Archimatix = Space.Host.ExecutingObject.Archimatix
clickableComponent = Space.Host.ExecutingObject.Clickable
EmbeddedVideo = Space.Host.ExecutingObject.EmbeddedVideo
Avatar = Space.Host.ExecutingObject.Avatar
AvatarAppearance = Space.Host.ExecutingObject.AvatarAppearance
Script = Space.Host.ExecutingObject.Script
StateMachine = Space.Host.ExecutingObject.StateMachine
SimpleNetworking = Space.Host.ExecutingObject.Networking
eventsComponent = Space.Host.ExecutingObject.Events
resourcesComponent = Space.Host.ExecutingObject.Resources
Data = Space.Host.ExecutingObject.Data
rigidbodyComponent = Space.Host.ExecutingObject.Rigidbody
colliderComponent =  Space.Host.ExecutingObject.Collider
BoxCollider = Space.Host.ExecutingObject.BoxCollider
SphereCollider = Space.Host.ExecutingObject.SphereCollider
CapsuleCollider = Space.Host.ExecutingObject.CapsuleCollider
WheelCollider = Space.Host.ExecutingObject.WheelCollider
CharacterController = Space.Host.ExecutingObject.CharacterController
AudioReactive = Space.Host.ExecutingObject.AudioReactive
AttachmentHelper = Space.Host.ExecutingObject.AttachmentHelper
AudioReactiveAnimation = Space.Host.ExecutingObject.AudioReactiveAnimation
AudioReactiveLight = Space.Host.ExecutingObject.AudioReactiveLight
AudioReactiveParticleSystem = Space.Host.ExecutingObject.AudioReactiveParticleSystem
AudioReactiveMaterial = Space.Host.ExecutingObject.AudioReactiveMaterial
AudioReactiveTransform = Space.Host.ExecutingObject.AudioReactiveTransform
TrailRenderer = Space.Host.ExecutingObject.TrailRenderer
LineRenderer = Space.Host.ExecutingObject.LineRenderer
UILayout = Space.Host.ExecutingObject.UILayout
UIToggle = Space.Host.ExecutingObject.UIToggle
UIDropdown = Space.Host.ExecutingObject.UIDropdown
UIButton = Space.Host.ExecutingObject.UIButton
uitext = Space.Host.ExecutingObject.UIText 
UISlider = Space.Host.ExecutingObject.UISlider
UIScrollbar = Space.Host.ExecutingObject.UIScrollbar
UICanvas = Space.Host.ExecutingObject.UICanvas
UIImage = Space.Host.ExecutingObject.UIImage
UIRawImage = Space.Host.ExecutingObject.UIRawImage
UIInputField = Space.Host.ExecutingObject.UIInputField
tooltipHint = Space.Host.ExecutingObject.UIToolTipHint
camera = Space.Host.ExecutingObject.Camera
VirtualCamera = Space.Host.ExecutingObject.VirtualCamera
Cloth = Space.Host.ExecutingObject.Cloth
MeshRenderer = Space.Host.ExecutingObject.MeshRenderer
Furniture = Space.Host.ExecutingObject.Furniture
navMeshAgent = Space.Host.ExecutingObject.AddNavMeshAgent()
NavMeshObstacle = Space.Host.ExecutingObject.NavMeshObstacle
ParticleSystem = Space.Host.ExecutingObject.ParticleSystem
RectTransform = Space.Host.ExecutingObject.RectTransform
seatComponent = Space.Host.ExecutingObject.AddSeat()
SkinnedMeshRenderer = Space.Host.ExecutingObject.SkinnedMeshRenderer
Radio = Space.Host.ExecutingObject.Radio
Terrain = Space.Host.ExecutingObject.Terrain
analyticsEvent = Space.Host.ExecutingObject.AnalyticsEvent
graphicRaycaster = Space.Host.ExecutingObject.GraphicRaycaster
contentSzeFitter = Space.Host.ExecutingObject.ContentSizeFitter
Space.Host.ExecutingObject.Active = false
--the below script will make this object become inactive
--after being being clicked
--(Example: picking up fruits)

thisGameObject = Space.Host.ExecutingObject


OnClick = function()
thisGameObject.Active = false
end

thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip="Pick me!"
thisGameObject.Clickable.OnClick(OnClick)
 Space.Host.ExecutingObject.ActiveSelf = false
Space.Host.ExecutingObject.Layer = 21
objectTag = Space.Host.ExecutingObject.Tag
Space.Host.ExecutingObject.Name = 'Hello World!'
Space.Host.ExecutingObject.Moniker = 'New  Moniker'
Space.Host.ExecutingObject.Parent = Space.Host.GetReference("TheOtherObject")
objectRoot = Space.Host.ExecutingObject.Root
tableChildren = Space.Host.ExecutingObject.Children
Space.Host.ExecutingObject.WorldPosition = Vector.New(1,1,1)
Space.Host.ExecutingObject.LocalPosition = Vector.New(1,1,1)
Space.Host.ExecutingObject.WorldRotation = Quaternion.Euler(0,180,0)
Space.Host.ExecutingObject.LocalRotation = Quaternion.Euler(0,180,0)
Space.Host.ExecutingObject.LocalScale = Vector.New(2,2,2)
worldScale = Space.Host.ExecutingObject.WorldScale 
vectorForward = Space.Host.ExecutingObject.Forward
vectorUp = Space.Host.ExecutingObject.Up
vectorRight = Space.Host.ExecutingObject.Right
EventCalendar = Space.Host.ExecutingObject.EventCalendar