(Added simple examples to SScene .PlayerAvatar .Avatars .Objects .CreateGameObject .Name .Url .Owner .PlayerIsOwner) |
m |
||
Line 2: | Line 2: | ||
==Members== | ==Members== | ||
− | {{ScriptFunction|SGameObject|Find|(string name);|Finds a single Game Object matching 'Name' and returns it. Can use '/' characters to designate a path (e.g. 'Parent/Child' returns Child with 'Parent')| | + | {{ScriptFunction|SGameObject|Find|(string name);|Finds a single Game Object matching 'Name' and returns it. Can use '/' characters to designate a path (e.g. 'Parent/Child' returns Child with 'Parent')|5= |
<pre> hand = Space.Scene.Find("Hand"); | <pre> hand = Space.Scene.Find("Hand"); | ||
--This returns the GameObject named Hand. | --This returns the GameObject named Hand. | ||
Line 18: | Line 18: | ||
--This returns the GameObject named Hand, | --This returns the GameObject named Hand, | ||
--which is a child of Arm > Monster. </pre>}} | --which is a child of Arm > Monster. </pre>}} | ||
− | {{ScriptFunction|SAvatar|PlayerAvatar|{ get; }|Returns the current player avatar. If this script is calling this upon initialisation, the Player may not exist yet, and you will want to wait a few frames until the avatar is present before continuing. | + | {{ScriptFunction|SAvatar|PlayerAvatar|{ get; }|Returns the current player avatar. If this script is calling this upon initialisation, the Player may not exist yet, and you will want to wait a few frames until the avatar is present before continuing.|5= |
<pre> CurrentPlayer = Space.Scene.PlayerAvatar </pre>}} | <pre> CurrentPlayer = Space.Scene.PlayerAvatar </pre>}} | ||
{{ScriptFunction|SAvatar|Avatars[]|{ get; }|Returns a list of Avatars in the scene|5= | {{ScriptFunction|SAvatar|Avatars[]|{ get; }|Returns a list of Avatars in the scene|5= |
The SScene class represents the region the user is currently in.
Finds a single Game Object matching 'Name' and returns it. Can use '/' characters to designate a path (e.g. 'Parent/Child' returns Child with 'Parent')
hand = Space.Scene.Find("Hand"); --This returns the GameObject named Hand. hand = Space.Scene.Find("/Hand"); --This returns the GameObject named Hand. --Hand must not have a parent in the Hierarchy view. hand = Space.Scene.Find("/Monster/Arm/Hand"); --This returns the GameObject named Hand, --which is a child of Arm > Monster. --Monster must not have a parent in the Hierarchy view. hand = Space.Scene.Find("Monster/Arm/Hand"); --This returns the GameObject named Hand, --which is a child of Arm > Monster.
Returns the current player avatar. If this script is calling this upon initialisation, the Player may not exist yet, and you will want to wait a few frames until the avatar is present before continuing.
CurrentPlayer = Space.Scene.PlayerAvatar
Returns a list of Avatars in the scene
avatars = Space.Scene.Avatars
Returns a list of Objects in the scene. IMPORTANT: This function is slow, you should cache the result and avoid calling this every frame.
objects = Space.Scene.Objects
Creates a new empty game object with the name 'Name' and returns a reference
newObject = Space.Scene.CreateGameObject("potato")
Creates a game object from the specified resource
Returns the name of the current region
RegionName = Space.Scene.Name
Returns the URL of the current region
RegionUrl = Space.Scene.Url
Returns the avatar ID of the regions owner
RegionOwner = Space.Scene.Owner
Returns whether the current player is the owner of the region
isOwner = Space.Scene.PlayerIsOwner
Event which fires whenever a player joins the region
Event which fires whenever a player leaves the region
|