# ScenePrivate

Kind: Class · Namespace: Sansar.Simulation · Assembly: Sansar.Simulation.dll · Script API 47.10.0

<div class="api-meta">
<span class="api-kind api-kind-class" data-pagefind-filter="kind:Class">Class</span>
<span data-pagefind-filter="namespace:Sansar.Simulation">Namespace <a href="/scripting/api/sansar.simulation"><code>Sansar.Simulation</code></a></span>
<span>Inherits <a href="/scripting/api/sansar.script/instanceinterface">Sansar.Script.InstanceInterface</a></span>
</div>

<span id="T:Sansar.Simulation.ScenePrivate"></span>

Interface for Scripts that are part of a Scene. A more complete and less limited API than [`ScenePublic`](/scripting/api/sansar.simulation/scenepublic)

```csharp
public class ScenePrivate : Sansar.Script.InstanceInterface
```

## Remarks

The ScenePrivate class provides services relating to the Scene.

## Members at a glance

| Kind | Members |
|---|---|
| **Fields** | [GravityMaximum](#gravitymaximum) · [GravityMinimum](#gravityminimum) · [MaximumCastRayResults](#maximumcastrayresults) · [MinimumCastRadius](#minimumcastradius) |
| **Properties** | [AgentCount](#agentcount) · [Chat](#chat) · [DefaultGravity](#defaultgravity) · [HttpClient](#httpclient) · [Reactions](#reactions) · [SceneInfo](#sceneinfo) · [User](#user) |
| **Methods** | [AddToSceneLibrary](#addtoscenelibrary) · [AddToSceneLibraryForAgent](#addtoscenelibraryforagent) · [CastBox](#castbox) · [CastCapsule](#castcapsule) · [CastRay](#castray) · [CastSphere](#castsphere) · [ClearAllowFlightOverrideForAgent](#clearallowflightoverrideforagent)&#160;<span class="api-dot" title="New in 47.10.0"><span class="api-sr">New in 47.10.0</span></span> · [ClearAllowFlightOverrides](#clearallowflightoverrides)&#160;<span class="api-dot" title="New in 47.10.0"><span class="api-sr">New in 47.10.0</span></span> · [ClearColorLut](#clearcolorlut)&#160;<span class="api-dot" title="New in 47.10.0"><span class="api-sr">New in 47.10.0</span></span> · [ClearColorLutOverrideForAgent](#clearcolorlutoverrideforagent)&#160;<span class="api-dot" title="New in 47.10.0"><span class="api-sr">New in 47.10.0</span></span> · [ClearColorLutOverrides](#clearcolorlutoverrides)&#160;<span class="api-dot" title="New in 47.10.0"><span class="api-sr">New in 47.10.0</span></span> · [ClearSceneLibrary](#clearscenelibrary) · [ClearSceneLibraryForAgent](#clearscenelibraryforagent) · [CreateCluster](#createcluster) · [CreateDataStore](#createdatastore) · [FindAgent](#findagent) · [FindObject](#findobject) · [FindReflective](#findreflective) · [FindScript](#findscript) · [GetAgent](#getagent) · [GetAgents](#getagents) · [GetAllowFlight](#getallowflight)&#160;<span class="api-dot" title="New in 47.10.0"><span class="api-sr">New in 47.10.0</span></span> · [GetBoxClosestPoints](#getboxclosestpoints) · [GetCapsuleClosestPoints](#getcapsuleclosestpoints) · [GetGravity](#getgravity) · [GetPortalCreatorName](#getportalcreatorname) · [GetPortalDescription](#getportaldescription) · [GetPortalUri](#getportaluri) · [GetSphereClosestPoints](#getsphereclosestpoints) · [GetTimeOfDay](#gettimeofday)&#160;<span class="api-dot" title="New in 47.10.0"><span class="api-sr">New in 47.10.0</span></span> · [GetTimeOfDayMode](#gettimeofdaymode)&#160;<span class="api-dot" title="New in 47.10.0"><span class="api-sr">New in 47.10.0</span></span> · [OverrideAudioStream](#overrideaudiostream) · [OverrideIndexedMediaSource](#overrideindexedmediasource) · [OverrideMediaSource](#overridemediasource) · [PerformIndexedMediaAction](#performindexedmediaaction) · [PerformMediaAction](#performmediaaction) · [PlaySound](#playsound) · [PlaySoundAtPosition](#playsoundatposition) · [PlayStream](#playstream) · [PlayStreamAtPosition](#playstreamatposition) · [RemoveFromSceneLibrary](#removefromscenelibrary) · [RemoveFromSceneLibraryForAgent](#removefromscenelibraryforagent) · [ResetScene](#resetscene) · [SetAllowFlight](#setallowflight)&#160;<span class="api-dot" title="New in 47.10.0"><span class="api-sr">New in 47.10.0</span></span> · [SetColorLut](#setcolorlut)&#160;<span class="api-dot" title="New in 47.10.0"><span class="api-sr">New in 47.10.0</span></span> · [SetGravity](#setgravity) · [SetMegaphone](#setmegaphone) · [SetTimeOfDay](#settimeofday)&#160;<span class="api-dot" title="New in 47.10.0"><span class="api-sr">New in 47.10.0</span></span> · [SetTimeOfDayMode](#settimeofdaymode)&#160;<span class="api-dot" title="New in 47.10.0"><span class="api-sr">New in 47.10.0</span></span> · [ShakeCameraAtPosition](#shakecameraatposition)&#160;<span class="api-dot" title="New in 47.10.0"><span class="api-sr">New in 47.10.0</span></span> · [StopAllCameraShakes](#stopallcamerashakes)&#160;<span class="api-dot" title="New in 47.10.0"><span class="api-sr">New in 47.10.0</span></span> · [ToString](#tostring) · [VoiceBroadcastStart](#voicebroadcaststart) · [VoiceBroadcastStop](#voicebroadcaststop) · [VoiceBroadcastStopAll](#voicebroadcaststopall) |

## Fields

### GravityMaximum

<div class="api-card">
<span id="F:Sansar.Simulation.ScenePrivate.GravityMaximum"></span>

```csharp signature
public static readonly float GravityMaximum
```

The maximum gravity magnitude in m/s^2, which is equal to 49.05 or 5 G&#39;s.

<details class="api-remarks"><summary>Remarks</summary>

A value greater than this will clamp to this value.

</details>

</div>

### GravityMinimum

<div class="api-card">
<span id="F:Sansar.Simulation.ScenePrivate.GravityMinimum"></span>

```csharp signature
public static readonly float GravityMinimum
```

The minimum allowed gravity magnitude in m/s^2, which is equal to zero.

<details class="api-remarks"><summary>Remarks</summary>

A value less than this will clamp to this value.

</details>

</div>

### MaximumCastRayResults

<div class="api-card">
<span id="F:Sansar.Simulation.ScenePrivate.MaximumCastRayResults"></span>

```csharp signature
public static readonly int MaximumCastRayResults
```

The maximum number of results returned from a `CastRay`, `CastSphere` or `CastBox` call. Anything over this will be truncated.

</div>

### MinimumCastRadius

<div class="api-card">
<span id="F:Sansar.Simulation.ScenePrivate.MinimumCastRadius"></span>

```csharp signature
public static readonly float MinimumCastRadius
```

The minimum radius for a `CastSphere` call or minimum half extents for `CastBox`. Any value smaller than this will use `CastRay` instead.

</div>


## Properties

### AgentCount

<div class="api-card">
<span id="P:Sansar.Simulation.ScenePrivate.AgentCount"></span>

```csharp signature
public uint AgentCount { get; }
```

The number of agents in the Scene.

**Value:** [uint](https://learn.microsoft.com/dotnet/api/system.uint32) — Unsigned integer count of the number of agents in the Scene.

<details class="api-remarks"><summary>Remarks</summary>

This number changes when agents join and part.

</details>

</div>

### Chat

<div class="api-card">
<span id="P:Sansar.Simulation.ScenePrivate.Chat"></span>

```csharp signature
public Chat Chat { get; }
```

Gets the Chat interface for this Scene

**Value:** [Chat](/scripting/api/sansar.simulation/chat) — The Chat Api

</div>

### DefaultGravity

<div class="api-card">
<span id="P:Sansar.Simulation.ScenePrivate.DefaultGravity"></span>

```csharp signature
public float DefaultGravity { get; }
```

The default gravity magnitude in the scene in m/s^2, which is equal to 9.81 or 1 G.

**Value:** [float](https://learn.microsoft.com/dotnet/api/system.single) — The default scene gravity magnitude.

<details class="api-remarks"><summary>Remarks</summary>

The direction of the gravity vector is constant.

</details>

<details class="api-example" open><summary>Example</summary>

```csharp
float sansarGravity = ScenePrivate.DefaultGravity; // Get default gravity in m/s^2
```

</details>

</div>

### HttpClient

<div class="api-card">
<span id="P:Sansar.Simulation.ScenePrivate.HttpClient"></span>

```csharp signature
public HttpClient HttpClient { get; }
```

Gets the HttpClient for this Scene

**Value:** [HttpClient](/scripting/api/sansar.simulation/httpclient) — The HttpClient Api

</div>

### Reactions

<div class="api-card">
<span id="P:Sansar.Simulation.ScenePrivate.Reactions"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 41.0.0</span></div>

```csharp signature
public Reactions Reactions { get; }
```

Gets the Reactions interface for this Scene

**Value:** [Reactions](/scripting/api/sansar.simulation/reactions) — The Chat Api

</div>

### SceneInfo

<div class="api-card">
<span id="P:Sansar.Simulation.ScenePrivate.SceneInfo"></span>

```csharp signature
public SceneInfo SceneInfo { get; }
```

Gets the SceneInfo for this Scene

**Value:** [SceneInfo](/scripting/api/sansar.simulation/sceneinfo) — The full SceneInfo Api

</div>

### User

<div class="api-card">
<span id="P:Sansar.Simulation.ScenePrivate.User"></span>

```csharp signature
public User User { get; }
```

Gets the User interface for this Scene

**Value:** [User](/scripting/api/sansar.simulation/user) — The User Api

</div>


## Methods

### AddToSceneLibrary

<div class="api-card" id="addtoscenelibrary-clusterresource-string">
<span id="M:Sansar.Simulation.ScenePrivate.AddToSceneLibrary(Sansar.Simulation.ClusterResource,System.String)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 47.1.1</span></div>

```csharp signature
public void AddToSceneLibrary(
    ClusterResource resource,
    string displayName
)
```

Add an item to the scene library for all users.

| Parameter | Type | Description |
|---|---|---|
| `resource` | [ClusterResource](/scripting/api/sansar.simulation/clusterresource) | The cluster resource to add. |
| `displayName` | [string](https://learn.microsoft.com/dotnet/api/system.string) | The display name shown in the backpack. |

</div>

<div class="api-card" id="addtoscenelibrary-clusterresource-string-string">
<span id="M:Sansar.Simulation.ScenePrivate.AddToSceneLibrary(Sansar.Simulation.ClusterResource,System.String,System.String)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 47.2.0</span></div>

```csharp signature
public void AddToSceneLibrary(
    ClusterResource resource,
    string displayName,
    string thumbnailAssetId
)
```

Add an item to the scene library for all users.

| Parameter | Type | Description |
|---|---|---|
| `resource` | [ClusterResource](/scripting/api/sansar.simulation/clusterresource) | The cluster resource to add. |
| `displayName` | [string](https://learn.microsoft.com/dotnet/api/system.string) | The display name shown in the backpack. |
| `thumbnailAssetId` | [string](https://learn.microsoft.com/dotnet/api/system.string) | Optional thumbnail asset id shown as the item icon. |

</div>

### AddToSceneLibraryForAgent

<div class="api-card" id="addtoscenelibraryforagent-agentprivate-clusterresource-string">
<span id="M:Sansar.Simulation.ScenePrivate.AddToSceneLibraryForAgent(Sansar.Simulation.AgentPrivate,Sansar.Simulation.ClusterResource,System.String)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 47.1.1</span></div>

```csharp signature
public void AddToSceneLibraryForAgent(
    AgentPrivate agent,
    ClusterResource resource,
    string displayName
)
```

Add an item to the scene library for a specific agent.

| Parameter | Type | Description |
|---|---|---|
| `agent` | [AgentPrivate](/scripting/api/sansar.simulation/agentprivate) | The target agent. |
| `resource` | [ClusterResource](/scripting/api/sansar.simulation/clusterresource) | The cluster resource to add. |
| `displayName` | [string](https://learn.microsoft.com/dotnet/api/system.string) | The display name shown in the backpack. |

</div>

<div class="api-card" id="addtoscenelibraryforagent-agentprivate-clusterresource-string-string">
<span id="M:Sansar.Simulation.ScenePrivate.AddToSceneLibraryForAgent(Sansar.Simulation.AgentPrivate,Sansar.Simulation.ClusterResource,System.String,System.String)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 47.2.0</span></div>

```csharp signature
public void AddToSceneLibraryForAgent(
    AgentPrivate agent,
    ClusterResource resource,
    string displayName,
    string thumbnailAssetId
)
```

Add an item to the scene library for a specific agent.

| Parameter | Type | Description |
|---|---|---|
| `agent` | [AgentPrivate](/scripting/api/sansar.simulation/agentprivate) | The target agent. |
| `resource` | [ClusterResource](/scripting/api/sansar.simulation/clusterresource) | The cluster resource to add. |
| `displayName` | [string](https://learn.microsoft.com/dotnet/api/system.string) | The display name shown in the backpack. |
| `thumbnailAssetId` | [string](https://learn.microsoft.com/dotnet/api/system.string) | Optional thumbnail asset id shown as the item icon. |

</div>

### CastBox

<div class="api-card" id="castbox-vector-vector-vector">
<span id="M:Sansar.Simulation.ScenePrivate.CastBox(Sansar.Vector,Sansar.Vector,Sansar.Vector)"></span>

```csharp signature
public RayCastHit[] CastBox(
    Sansar.Vector halfExtents,
    Sansar.Vector start,
    Sansar.Vector end
)
```

Casts a box from start to end and returns an array of collisions along the path.

| Parameter | Type | Description |
|---|---|---|
| `halfExtents` | [Sansar.Vector](/scripting/api/sansar/vector) | The x,y,z distance from the center of the box to the corresponding face. |
| `start` | [Sansar.Vector](/scripting/api/sansar/vector) | The initial point of the query. |
| `end` | [Sansar.Vector](/scripting/api/sansar/vector) | The end point of the query. |

**Returns:** [RayCastHit](/scripting/api/sansar.simulation/raycasthit)\[\]

<details class="api-remarks"><summary>Remarks</summary>

If all 3 dimensions are less than [`ScenePrivate.MinimumCastRadius`](/scripting/api/sansar.simulation/sceneprivate#minimumcastradius) the call will be forwarded to `CastRay` instead. maxHits defaults to 1 if unspecified and will return only the nearest hit.

</details>

</div>

<div class="api-card" id="castbox-vector-quaternion-vector-vector">
<span id="M:Sansar.Simulation.ScenePrivate.CastBox(Sansar.Vector,Sansar.Quaternion,Sansar.Vector,Sansar.Vector)"></span>

```csharp signature
public RayCastHit[] CastBox(
    Sansar.Vector halfExtents,
    Sansar.Quaternion orientation,
    Sansar.Vector start,
    Sansar.Vector end
)
```

Casts a box from start to end and returns an array of collisions along the path.

| Parameter | Type | Description |
|---|---|---|
| `halfExtents` | [Sansar.Vector](/scripting/api/sansar/vector) | The x,y,z distance from the center of the box to the corresponding face. |
| `orientation` | [Sansar.Quaternion](/scripting/api/sansar/quaternion) | The orientation of the query shape. |
| `start` | [Sansar.Vector](/scripting/api/sansar/vector) | The initial point of the query. |
| `end` | [Sansar.Vector](/scripting/api/sansar/vector) | The end point of the query. |

**Returns:** [RayCastHit](/scripting/api/sansar.simulation/raycasthit)\[\]

<details class="api-remarks"><summary>Remarks</summary>

If all 3 dimensions are less than [`ScenePrivate.MinimumCastRadius`](/scripting/api/sansar.simulation/sceneprivate#minimumcastradius) the call will be forwarded to `CastRay` instead.

</details>

</div>

<div class="api-card" id="castbox-vector-vector-vector-int32">
<span id="M:Sansar.Simulation.ScenePrivate.CastBox(Sansar.Vector,Sansar.Vector,Sansar.Vector,System.Int32)"></span>

```csharp signature
public RayCastHit[] CastBox(
    Sansar.Vector halfExtents,
    Sansar.Vector start,
    Sansar.Vector end,
    int maxHits
)
```

Casts a box from start to end and returns an array of collisions along the path.

| Parameter | Type | Description |
|---|---|---|
| `halfExtents` | [Sansar.Vector](/scripting/api/sansar/vector) | The x,y,z distance from the center of the box to the corresponding face. |
| `start` | [Sansar.Vector](/scripting/api/sansar/vector) | The initial point of the query. |
| `end` | [Sansar.Vector](/scripting/api/sansar/vector) | The end point of the query. |
| `maxHits` | [int](https://learn.microsoft.com/dotnet/api/system.int32) | Limit the number of results returned. |

**Returns:** [RayCastHit](/scripting/api/sansar.simulation/raycasthit)\[\]

<details class="api-remarks"><summary>Remarks</summary>

If all 3 dimensions are less than [`ScenePrivate.MinimumCastRadius`](/scripting/api/sansar.simulation/sceneprivate#minimumcastradius) the call will be forwarded to `CastRay` instead. maxHits defaults to 1 if unspecified and will return only the nearest hit.

</details>

</div>

<div class="api-card" id="castbox-vector-quaternion-vector-vector-int32">
<span id="M:Sansar.Simulation.ScenePrivate.CastBox(Sansar.Vector,Sansar.Quaternion,Sansar.Vector,Sansar.Vector,System.Int32)"></span>

```csharp signature
public RayCastHit[] CastBox(
    Sansar.Vector halfExtents,
    Sansar.Quaternion orientation,
    Sansar.Vector start,
    Sansar.Vector end,
    int maxHits
)
```

Casts a box from start to end and returns an array of collisions along the path.

| Parameter | Type | Description |
|---|---|---|
| `halfExtents` | [Sansar.Vector](/scripting/api/sansar/vector) | The x,y,z distance from the center of the box to the corresponding face. |
| `orientation` | [Sansar.Quaternion](/scripting/api/sansar/quaternion) | The orientation of the query shape. |
| `start` | [Sansar.Vector](/scripting/api/sansar/vector) | The initial point of the query. |
| `end` | [Sansar.Vector](/scripting/api/sansar/vector) | The end point of the query. |
| `maxHits` | [int](https://learn.microsoft.com/dotnet/api/system.int32) | Limit the number of results returned. |

**Returns:** [RayCastHit](/scripting/api/sansar.simulation/raycasthit)\[\]

<details class="api-remarks"><summary>Remarks</summary>

If all 3 dimensions are less than [`ScenePrivate.MinimumCastRadius`](/scripting/api/sansar.simulation/sceneprivate#minimumcastradius) the call will be forwarded to `CastRay` instead.

</details>

</div>

### CastCapsule

<div class="api-card" id="castcapsule-vector-vector-single-vector-vector">
<span id="M:Sansar.Simulation.ScenePrivate.CastCapsule(Sansar.Vector,Sansar.Vector,System.Single,Sansar.Vector,Sansar.Vector)"></span>

```csharp signature
public RayCastHit[] CastCapsule(
    Sansar.Vector capsuleStart,
    Sansar.Vector capsuleEnd,
    float capsuleRadius,
    Sansar.Vector start,
    Sansar.Vector end
)
```

Casts a capsule from start to end and returns an array of collisions along the path.

| Parameter | Type | Description |
|---|---|---|
| `capsuleStart` | [Sansar.Vector](/scripting/api/sansar/vector) | The base point of the capsule. |
| `capsuleEnd` | [Sansar.Vector](/scripting/api/sansar/vector) | The end point of the capsule. |
| `capsuleRadius` | [float](https://learn.microsoft.com/dotnet/api/system.single) | The radius of the capsule to query. |
| `start` | [Sansar.Vector](/scripting/api/sansar/vector) | The initial point of the query. |
| `end` | [Sansar.Vector](/scripting/api/sansar/vector) | The end point of the query. |

**Returns:** [RayCastHit](/scripting/api/sansar.simulation/raycasthit)\[\]

<details class="api-remarks"><summary>Remarks</summary>

If the radius and capsule length are less than [`ScenePrivate.MinimumCastRadius`](/scripting/api/sansar.simulation/sceneprivate#minimumcastradius) the call will be forwarded to `CastRay` instead.

</details>

</div>

<div class="api-card" id="castcapsule-vector-vector-single-quaternion-vector-vector">
<span id="M:Sansar.Simulation.ScenePrivate.CastCapsule(Sansar.Vector,Sansar.Vector,System.Single,Sansar.Quaternion,Sansar.Vector,Sansar.Vector)"></span>

```csharp signature
public RayCastHit[] CastCapsule(
    Sansar.Vector capsuleStart,
    Sansar.Vector capsuleEnd,
    float capsuleRadius,
    Sansar.Quaternion orientation,
    Sansar.Vector start,
    Sansar.Vector end
)
```

Casts a capsule from start to end and returns an array of collisions along the path.

| Parameter | Type | Description |
|---|---|---|
| `capsuleStart` | [Sansar.Vector](/scripting/api/sansar/vector) | The base point of the capsule. |
| `capsuleEnd` | [Sansar.Vector](/scripting/api/sansar/vector) | The end point of the capsule. |
| `capsuleRadius` | [float](https://learn.microsoft.com/dotnet/api/system.single) | The radius of the capsule to query. |
| `orientation` | [Sansar.Quaternion](/scripting/api/sansar/quaternion) | The orientation of the query shape. |
| `start` | [Sansar.Vector](/scripting/api/sansar/vector) | The initial point of the query. |
| `end` | [Sansar.Vector](/scripting/api/sansar/vector) | The end point of the query. |

**Returns:** [RayCastHit](/scripting/api/sansar.simulation/raycasthit)\[\]

<details class="api-remarks"><summary>Remarks</summary>

If the radius and capsule length are less than [`ScenePrivate.MinimumCastRadius`](/scripting/api/sansar.simulation/sceneprivate#minimumcastradius) the call will be forwarded to `CastRay` instead.

</details>

</div>

<div class="api-card" id="castcapsule-vector-vector-single-vector-vector-int32">
<span id="M:Sansar.Simulation.ScenePrivate.CastCapsule(Sansar.Vector,Sansar.Vector,System.Single,Sansar.Vector,Sansar.Vector,System.Int32)"></span>

```csharp signature
public RayCastHit[] CastCapsule(
    Sansar.Vector capsuleStart,
    Sansar.Vector capsuleEnd,
    float capsuleRadius,
    Sansar.Vector start,
    Sansar.Vector end,
    int maxHits
)
```

Casts a capsule from start to end and returns an array of collisions along the path.

| Parameter | Type | Description |
|---|---|---|
| `capsuleStart` | [Sansar.Vector](/scripting/api/sansar/vector) | The base point of the capsule. |
| `capsuleEnd` | [Sansar.Vector](/scripting/api/sansar/vector) | The end point of the capsule. |
| `capsuleRadius` | [float](https://learn.microsoft.com/dotnet/api/system.single) | The radius of the capsule to query. |
| `start` | [Sansar.Vector](/scripting/api/sansar/vector) | The initial point of the query. |
| `end` | [Sansar.Vector](/scripting/api/sansar/vector) | The end point of the query. |
| `maxHits` | [int](https://learn.microsoft.com/dotnet/api/system.int32) | Limit the number of results returned. |

**Returns:** [RayCastHit](/scripting/api/sansar.simulation/raycasthit)\[\]

<details class="api-remarks"><summary>Remarks</summary>

If the radius and capsule length are less than [`ScenePrivate.MinimumCastRadius`](/scripting/api/sansar.simulation/sceneprivate#minimumcastradius) the call will be forwarded to `CastRay` instead.

</details>

</div>

<div class="api-card" id="castcapsule-vector-vector-single-quaternion-vector-vector-int32">
<span id="M:Sansar.Simulation.ScenePrivate.CastCapsule(Sansar.Vector,Sansar.Vector,System.Single,Sansar.Quaternion,Sansar.Vector,Sansar.Vector,System.Int32)"></span>

```csharp signature
public RayCastHit[] CastCapsule(
    Sansar.Vector capsuleStart,
    Sansar.Vector capsuleEnd,
    float capsuleRadius,
    Sansar.Quaternion orientation,
    Sansar.Vector start,
    Sansar.Vector end,
    int maxHits
)
```

Casts a capsule from start to end and returns an array of collisions along the path.

| Parameter | Type | Description |
|---|---|---|
| `capsuleStart` | [Sansar.Vector](/scripting/api/sansar/vector) | The base point of the capsule. |
| `capsuleEnd` | [Sansar.Vector](/scripting/api/sansar/vector) | The end point of the capsule. |
| `capsuleRadius` | [float](https://learn.microsoft.com/dotnet/api/system.single) | The radius of the capsule to query. |
| `orientation` | [Sansar.Quaternion](/scripting/api/sansar/quaternion) | The orientation of the query shape. |
| `start` | [Sansar.Vector](/scripting/api/sansar/vector) | The initial point of the query. |
| `end` | [Sansar.Vector](/scripting/api/sansar/vector) | The end point of the query. |
| `maxHits` | [int](https://learn.microsoft.com/dotnet/api/system.int32) | Limit the number of results returned. |

**Returns:** [RayCastHit](/scripting/api/sansar.simulation/raycasthit)\[\]

<details class="api-remarks"><summary>Remarks</summary>

If the radius and capsule length are less than [`ScenePrivate.MinimumCastRadius`](/scripting/api/sansar.simulation/sceneprivate#minimumcastradius) the call will be forwarded to `CastRay` instead.

</details>

</div>

### CastRay

<div class="api-card" id="castray-vector-vector">
<span id="M:Sansar.Simulation.ScenePrivate.CastRay(Sansar.Vector,Sansar.Vector)"></span>

```csharp signature
public RayCastHit[] CastRay(Sansar.Vector start, Sansar.Vector end)
```

Casts a ray from start to end and returns an array of collisions along the path.

| Parameter | Type | Description |
|---|---|---|
| `start` | [Sansar.Vector](/scripting/api/sansar/vector) | The initial point of the query. |
| `end` | [Sansar.Vector](/scripting/api/sansar/vector) | The end point of the query. |

**Returns:** [RayCastHit](/scripting/api/sansar.simulation/raycasthit)\[\] — An array of hit results, ordered from nearest to furthest. If the cast did not hit anything the array will be empty.

<details class="api-remarks"><summary>Remarks</summary>

maxHits defaults to 1 if unspecified and will return only the nearest hit.

</details>

</div>

<div class="api-card" id="castray-vector-vector-int32">
<span id="M:Sansar.Simulation.ScenePrivate.CastRay(Sansar.Vector,Sansar.Vector,System.Int32)"></span>

```csharp signature
public RayCastHit[] CastRay(
    Sansar.Vector start,
    Sansar.Vector end,
    int maxHits
)
```

Casts a ray from start to end and returns an array of collisions along the path.

| Parameter | Type | Description |
|---|---|---|
| `start` | [Sansar.Vector](/scripting/api/sansar/vector) | The initial point of the query. |
| `end` | [Sansar.Vector](/scripting/api/sansar/vector) | The end point of the query. |
| `maxHits` | [int](https://learn.microsoft.com/dotnet/api/system.int32) | Limit the number of results returned. |

**Returns:** [RayCastHit](/scripting/api/sansar.simulation/raycasthit)\[\] — An array of hit results, ordered from nearest to furthest. If the cast did not hit anything the array will be empty.

<details class="api-remarks"><summary>Remarks</summary>

maxHits defaults to 1 if unspecified and will return only the nearest hit.

</details>

</div>

### CastSphere

<div class="api-card" id="castsphere-single-vector-vector">
<span id="M:Sansar.Simulation.ScenePrivate.CastSphere(System.Single,Sansar.Vector,Sansar.Vector)"></span>

```csharp signature
public RayCastHit[] CastSphere(
    float radius,
    Sansar.Vector start,
    Sansar.Vector end
)
```

Casts a sphere from start to end and returns an array of collisions along the path.

| Parameter | Type | Description |
|---|---|---|
| `radius` | [float](https://learn.microsoft.com/dotnet/api/system.single) | The radius of the sphere. |
| `start` | [Sansar.Vector](/scripting/api/sansar/vector) | The initial point of the query. |
| `end` | [Sansar.Vector](/scripting/api/sansar/vector) | The end point of the query. |

**Returns:** [RayCastHit](/scripting/api/sansar.simulation/raycasthit)\[\] — An array of hit results, ordered from nearest to furthest. If the cast did not hit anything the array will be empty.

<details class="api-remarks"><summary>Remarks</summary>

If the radius is less than [`ScenePrivate.MinimumCastRadius`](/scripting/api/sansar.simulation/sceneprivate#minimumcastradius) the call will be forwarded to [`ScenePrivate.CastRay`](/scripting/api/sansar.simulation/sceneprivate#castray-vector-vector-int32) instead. maxHits defaults to 1 if unspecified and will return only the nearest hit.

</details>

</div>

<div class="api-card" id="castsphere-single-vector-vector-int32">
<span id="M:Sansar.Simulation.ScenePrivate.CastSphere(System.Single,Sansar.Vector,Sansar.Vector,System.Int32)"></span>

```csharp signature
public RayCastHit[] CastSphere(
    float radius,
    Sansar.Vector start,
    Sansar.Vector end,
    int maxHits
)
```

Casts a sphere from start to end and returns an array of collisions along the path.

| Parameter | Type | Description |
|---|---|---|
| `radius` | [float](https://learn.microsoft.com/dotnet/api/system.single) | The radius of the sphere. |
| `start` | [Sansar.Vector](/scripting/api/sansar/vector) | The initial point of the query. |
| `end` | [Sansar.Vector](/scripting/api/sansar/vector) | The end point of the query. |
| `maxHits` | [int](https://learn.microsoft.com/dotnet/api/system.int32) | Limit the number of results returned. |

**Returns:** [RayCastHit](/scripting/api/sansar.simulation/raycasthit)\[\] — An array of hit results, ordered from nearest to furthest. If the cast did not hit anything the array will be empty.

<details class="api-remarks"><summary>Remarks</summary>

If the radius is less than [`ScenePrivate.MinimumCastRadius`](/scripting/api/sansar.simulation/sceneprivate#minimumcastradius) the call will be forwarded to [`ScenePrivate.CastRay`](/scripting/api/sansar.simulation/sceneprivate#castray-vector-vector-int32) instead. maxHits defaults to 1 if unspecified and will return only the nearest hit.

</details>

</div>

### ClearAllowFlightOverrideForAgent

<div class="api-card" id="clearallowflightoverrideforagent-agentprivate">
<span id="M:Sansar.Simulation.ScenePrivate.ClearAllowFlightOverrideForAgent(Sansar.Simulation.AgentPrivate)"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public void ClearAllowFlightOverrideForAgent(AgentPrivate agent)
```

Clears the per-agent flight override for a specific agent.

| Parameter | Type | Description |
|---|---|---|
| `agent` | [AgentPrivate](/scripting/api/sansar.simulation/agentprivate) | The target agent. |

<details class="api-remarks"><summary>Remarks</summary>

The agent will inherit this instance&#39;s default. The write is queued for the next world update. The callback, or [`ScriptBase.WaitFor`](/scripting/api/sansar.script/scriptbase#waitfor) in a coroutine, reports whether the server committed the change and queued the client update, not client acknowledgment; it fails if the agent has left.

</details>

</div>

<div class="api-card" id="clearallowflightoverrideforagent-agentprivate-action">
<span id="M:Sansar.Simulation.ScenePrivate.ClearAllowFlightOverrideForAgent(Sansar.Simulation.AgentPrivate,System.Action{Sansar.Script.OperationCompleteEvent})"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public void ClearAllowFlightOverrideForAgent(
    AgentPrivate agent,
    Action<Sansar.Script.OperationCompleteEvent> handler
)
```

Clears the per-agent flight override for a specific agent.

| Parameter | Type | Description |
|---|---|---|
| `agent` | [AgentPrivate](/scripting/api/sansar.simulation/agentprivate) | The target agent. |
| `handler` | [Action&lt;Sansar.Script.OperationCompleteEvent&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

<details class="api-remarks"><summary>Remarks</summary>

The agent will inherit this instance&#39;s default. The write is queued for the next world update. The callback, or [`ScriptBase.WaitFor`](/scripting/api/sansar.script/scriptbase#waitfor) in a coroutine, reports whether the server committed the change and queued the client update, not client acknowledgment; it fails if the agent has left.

</details>

</div>

### ClearAllowFlightOverrides

<div class="api-card" id="clearallowflightoverrides-noargs">
<span id="M:Sansar.Simulation.ScenePrivate.ClearAllowFlightOverrides"></span>
<span id="M:Sansar.Simulation.ScenePrivate.ClearAllowFlightOverrides()"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public void ClearAllowFlightOverrides()
```

Clears all per-agent flight overrides in this scene.

<details class="api-remarks"><summary>Remarks</summary>

All agents will inherit this instance&#39;s unchanged default. The write is queued for the next world update. The callback, or [`ScriptBase.WaitFor`](/scripting/api/sansar.script/scriptbase#waitfor) in a coroutine, reports whether the server committed the change and queued client updates, not client acknowledgment.

</details>

</div>

<div class="api-card" id="clearallowflightoverrides-action">
<span id="M:Sansar.Simulation.ScenePrivate.ClearAllowFlightOverrides(System.Action{Sansar.Script.OperationCompleteEvent})"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public void ClearAllowFlightOverrides(
    Action<Sansar.Script.OperationCompleteEvent> handler
)
```

Clears all per-agent flight overrides in this scene.

| Parameter | Type | Description |
|---|---|---|
| `handler` | [Action&lt;Sansar.Script.OperationCompleteEvent&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

<details class="api-remarks"><summary>Remarks</summary>

All agents will inherit this instance&#39;s unchanged default. The write is queued for the next world update. The callback, or [`ScriptBase.WaitFor`](/scripting/api/sansar.script/scriptbase#waitfor) in a coroutine, reports whether the server committed the change and queued client updates, not client acknowledgment.

</details>

</div>

### ClearColorLut

<div class="api-card" id="clearcolorlut-noargs">
<span id="M:Sansar.Simulation.ScenePrivate.ClearColorLut"></span>
<span id="M:Sansar.Simulation.ScenePrivate.ClearColorLut()"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public void ClearColorLut()
```

Removes the scene-wide color LUT override, going back to the LUT chosen in the scene settings.

<details class="api-remarks"><summary>Remarks</summary>

Per-agent overrides persist until cleared or the agent leaves. The write is queued for the next world update. The callback, or [`ScriptBase.WaitFor`](/scripting/api/sansar.script/scriptbase#waitfor) in a coroutine, reports whether the server committed the change and queued client updates, not client acknowledgment.

</details>

</div>

<div class="api-card" id="clearcolorlut-action">
<span id="M:Sansar.Simulation.ScenePrivate.ClearColorLut(System.Action{Sansar.Script.OperationCompleteEvent})"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public void ClearColorLut(
    Action<Sansar.Script.OperationCompleteEvent> handler
)
```

Removes the scene-wide color LUT override, going back to the LUT chosen in the scene settings.

| Parameter | Type | Description |
|---|---|---|
| `handler` | [Action&lt;Sansar.Script.OperationCompleteEvent&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

<details class="api-remarks"><summary>Remarks</summary>

Per-agent overrides persist until cleared or the agent leaves. The write is queued for the next world update. The callback, or [`ScriptBase.WaitFor`](/scripting/api/sansar.script/scriptbase#waitfor) in a coroutine, reports whether the server committed the change and queued client updates, not client acknowledgment.

</details>

</div>

### ClearColorLutOverrideForAgent

<div class="api-card" id="clearcolorlutoverrideforagent-agentprivate">
<span id="M:Sansar.Simulation.ScenePrivate.ClearColorLutOverrideForAgent(Sansar.Simulation.AgentPrivate)"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public void ClearColorLutOverrideForAgent(AgentPrivate agent)
```

Clears the per-agent color LUT override for a specific agent.

| Parameter | Type | Description |
|---|---|---|
| `agent` | [AgentPrivate](/scripting/api/sansar.simulation/agentprivate) | The target agent. |

<details class="api-remarks"><summary>Remarks</summary>

The agent goes back to the scene-wide LUT. The write is queued for the next world update. The callback, or [`ScriptBase.WaitFor`](/scripting/api/sansar.script/scriptbase#waitfor) in a coroutine, reports whether the server committed the change and queued the client update, not client acknowledgment; it fails if the agent has left.

</details>

</div>

<div class="api-card" id="clearcolorlutoverrideforagent-agentprivate-action">
<span id="M:Sansar.Simulation.ScenePrivate.ClearColorLutOverrideForAgent(Sansar.Simulation.AgentPrivate,System.Action{Sansar.Script.OperationCompleteEvent})"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public void ClearColorLutOverrideForAgent(
    AgentPrivate agent,
    Action<Sansar.Script.OperationCompleteEvent> handler
)
```

Clears the per-agent color LUT override for a specific agent.

| Parameter | Type | Description |
|---|---|---|
| `agent` | [AgentPrivate](/scripting/api/sansar.simulation/agentprivate) | The target agent. |
| `handler` | [Action&lt;Sansar.Script.OperationCompleteEvent&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

<details class="api-remarks"><summary>Remarks</summary>

The agent goes back to the scene-wide LUT. The write is queued for the next world update. The callback, or [`ScriptBase.WaitFor`](/scripting/api/sansar.script/scriptbase#waitfor) in a coroutine, reports whether the server committed the change and queued the client update, not client acknowledgment; it fails if the agent has left.

</details>

</div>

### ClearColorLutOverrides

<div class="api-card" id="clearcolorlutoverrides-noargs">
<span id="M:Sansar.Simulation.ScenePrivate.ClearColorLutOverrides"></span>
<span id="M:Sansar.Simulation.ScenePrivate.ClearColorLutOverrides()"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public void ClearColorLutOverrides()
```

Clears all per-agent color LUT overrides in this scene.

<details class="api-remarks"><summary>Remarks</summary>

All agents go back to the scene-wide LUT, which is left as it is. The write is queued for the next world update. The callback, or [`ScriptBase.WaitFor`](/scripting/api/sansar.script/scriptbase#waitfor) in a coroutine, reports whether the server committed the change and queued client updates, not client acknowledgment.

</details>

</div>

<div class="api-card" id="clearcolorlutoverrides-action">
<span id="M:Sansar.Simulation.ScenePrivate.ClearColorLutOverrides(System.Action{Sansar.Script.OperationCompleteEvent})"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public void ClearColorLutOverrides(
    Action<Sansar.Script.OperationCompleteEvent> handler
)
```

Clears all per-agent color LUT overrides in this scene.

| Parameter | Type | Description |
|---|---|---|
| `handler` | [Action&lt;Sansar.Script.OperationCompleteEvent&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

<details class="api-remarks"><summary>Remarks</summary>

All agents go back to the scene-wide LUT, which is left as it is. The write is queued for the next world update. The callback, or [`ScriptBase.WaitFor`](/scripting/api/sansar.script/scriptbase#waitfor) in a coroutine, reports whether the server committed the change and queued client updates, not client acknowledgment.

</details>

</div>

### ClearSceneLibrary

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.ClearSceneLibrary"></span>
<span id="M:Sansar.Simulation.ScenePrivate.ClearSceneLibrary()"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 47.1.1</span></div>

```csharp signature
public void ClearSceneLibrary()
```

Remove all items from the scene library for all users.

</div>

### ClearSceneLibraryForAgent

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.ClearSceneLibraryForAgent(Sansar.Simulation.AgentPrivate)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 47.1.1</span></div>

```csharp signature
public void ClearSceneLibraryForAgent(AgentPrivate agent)
```

Remove all per-agent scene library items for a specific agent.

| Parameter | Type | Description |
|---|---|---|
| `agent` | [AgentPrivate](/scripting/api/sansar.simulation/agentprivate) | The target agent. |

</div>

### CreateCluster

<div class="api-card" id="createcluster-clusterresource-vector-quaternion-vector">
<span id="M:Sansar.Simulation.ScenePrivate.CreateCluster(Sansar.Simulation.ClusterResource,Sansar.Vector,Sansar.Quaternion,Sansar.Vector)"></span>

```csharp signature
public ulong CreateCluster(
    ClusterResource asset,
    Sansar.Vector position,
    Sansar.Quaternion rotation,
    Sansar.Vector initialVelocity
)
```

Creates a new cluster and adds it to the Scene.

| Parameter | Type | Description |
|---|---|---|
| `asset` | [ClusterResource](/scripting/api/sansar.simulation/clusterresource) | Asset identifier to create. |
| `position` | [Sansar.Vector](/scripting/api/sansar/vector) | Mono.Simd.Vector4f for the initial position. |
| `rotation` | [Sansar.Quaternion](/scripting/api/sansar/quaternion) | Mono.Simd.Vector4f for the initial rotation. |
| `initialVelocity` | [Sansar.Vector](/scripting/api/sansar/vector) | Mono.Simd.Vector4f for the initial velocity. |

**Returns:** [ulong](https://learn.microsoft.com/dotnet/api/system.uint64) — The internal event id for the completion event.

<details class="api-remarks"><summary>Remarks</summary>

The new object may start simulating before the event is triggered.

</details>

</div>

<div class="api-card" id="createcluster-clusterresource-vector-quaternion-vector-createclusterhandler">
<span id="M:Sansar.Simulation.ScenePrivate.CreateCluster(Sansar.Simulation.ClusterResource,Sansar.Vector,Sansar.Quaternion,Sansar.Vector,Sansar.Simulation.ScenePrivate.CreateClusterHandler)"></span>
<div class="api-badges"><span class="api-badge api-deprecated">Deprecated</span></div>

```csharp signature
[System.Obsolete("Deprecated. Use the Action<> overload", false)]
public ulong CreateCluster(
    ClusterResource asset,
    Sansar.Vector position,
    Sansar.Quaternion rotation,
    Sansar.Vector initialVelocity,
    ScenePrivate.CreateClusterHandler handler
)
```

Creates a new cluster and adds it to the Scene.

| Parameter | Type | Description |
|---|---|---|
| `asset` | [ClusterResource](/scripting/api/sansar.simulation/clusterresource) | Asset identifier to create. |
| `position` | [Sansar.Vector](/scripting/api/sansar/vector) | Mono.Simd.Vector4f for the initial position. |
| `rotation` | [Sansar.Quaternion](/scripting/api/sansar/quaternion) | Mono.Simd.Vector4f for the initial rotation. |
| `initialVelocity` | [Sansar.Vector](/scripting/api/sansar/vector) | Mono.Simd.Vector4f for the initial velocity. |
| `handler` | [ScenePrivate.CreateClusterHandler](/scripting/api/sansar.simulation/sceneprivate.createclusterhandler) | Handler to be called when the event completes. |

**Returns:** [ulong](https://learn.microsoft.com/dotnet/api/system.uint64) — The internal event id for the completion event.

<details class="api-remarks"><summary>Remarks</summary>

The new object may start simulating before the event is triggered.

</details>

</div>

<div class="api-card" id="createcluster-clusterresource-vector-quaternion-vector-action">
<span id="M:Sansar.Simulation.ScenePrivate.CreateCluster(Sansar.Simulation.ClusterResource,Sansar.Vector,Sansar.Quaternion,Sansar.Vector,System.Action{Sansar.Simulation.ScenePrivate.CreateClusterData})"></span>

```csharp signature
public void CreateCluster(
    ClusterResource asset,
    Sansar.Vector position,
    Sansar.Quaternion rotation,
    Sansar.Vector initialVelocity,
    Action<ScenePrivate.CreateClusterData> handler
)
```

Creates a new cluster and adds it to the Scene.

| Parameter | Type | Description |
|---|---|---|
| `asset` | [ClusterResource](/scripting/api/sansar.simulation/clusterresource) | Asset identifier to create. |
| `position` | [Sansar.Vector](/scripting/api/sansar/vector) | Mono.Simd.Vector4f for the initial position. |
| `rotation` | [Sansar.Quaternion](/scripting/api/sansar/quaternion) | Mono.Simd.Vector4f for the initial rotation. |
| `initialVelocity` | [Sansar.Vector](/scripting/api/sansar/vector) | Mono.Simd.Vector4f for the initial velocity. |
| `handler` | [Action&lt;ScenePrivate.CreateClusterData&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

<details class="api-remarks"><summary>Remarks</summary>

The new object may start simulating before the event is triggered.

</details>

</div>

### CreateDataStore

<div class="api-card" id="createdatastore-guid">
<span id="M:Sansar.Simulation.ScenePrivate.CreateDataStore(System.Guid)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 37.1.0</span></div>

```csharp signature
public DataStore CreateDataStore(Guid id)
```

Returns a new instance of the [`DataStore`](/scripting/api/sansar.simulation/datastore) class.

| Parameter | Type | Description |
|---|---|---|
| `id` | [Guid](https://learn.microsoft.com/dotnet/api/system.guid) | The id of the [`DataStore`](/scripting/api/sansar.simulation/datastore) to create. |

**Returns:** [DataStore](/scripting/api/sansar.simulation/datastore) — A new [`DataStore`](/scripting/api/sansar.simulation/datastore) object.

<details class="api-remarks"><summary>Remarks</summary>

All [`DataStore`](/scripting/api/sansar.simulation/datastore) objects with a given [`DataStore.Id`](/scripting/api/sansar.simulation/datastore#id) share the same database.

</details>

</div>

<div class="api-card" id="createdatastore-string">
<span id="M:Sansar.Simulation.ScenePrivate.CreateDataStore(System.String)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 37.1.0</span></div>

```csharp signature
public DataStore CreateDataStore(string id)
```

Returns a new instance of the [`DataStore`](/scripting/api/sansar.simulation/datastore) class.

| Parameter | Type | Description |
|---|---|---|
| `id` | [string](https://learn.microsoft.com/dotnet/api/system.string) | String used to generate an id. If the id is a valid Guid then it will be used directly. |

**Returns:** [DataStore](/scripting/api/sansar.simulation/datastore) — A new [`DataStore`](/scripting/api/sansar.simulation/datastore) object.

<details class="api-remarks"><summary>Remarks</summary>

All [`DataStore`](/scripting/api/sansar.simulation/datastore) objects with a given [`DataStore.Id`](/scripting/api/sansar.simulation/datastore#id) share the same database. Ensure that this value is kept secret and unique.

</details>

</div>

### FindAgent

<div class="api-card" id="findagent-objectid">
<span id="M:Sansar.Simulation.ScenePrivate.FindAgent(Sansar.Script.ObjectId)"></span>

```csharp signature
public AgentPrivate FindAgent(Sansar.Script.ObjectId objectId)
```

Looks up an Agent associated with the given object id.

| Parameter | Type | Description |
|---|---|---|
| `objectId` | [Sansar.Script.ObjectId](/scripting/api/sansar.script/objectid) | The object to find. |

**Returns:** [AgentPrivate](/scripting/api/sansar.simulation/agentprivate) — The agent, or null if an agent cannot be found with that id.

<details class="api-remarks"><summary>Remarks</summary>

Agents may leave at any time.

</details>

</div>

<div class="api-card" id="findagent-sessionid">
<span id="M:Sansar.Simulation.ScenePrivate.FindAgent(Sansar.Script.SessionId)"></span>

```csharp signature
public AgentPrivate FindAgent(Sansar.Script.SessionId sessionId)
```

Looks up an Agent associated with the given session id if they are in the scene.

| Parameter | Type | Description |
|---|---|---|
| `sessionId` | [Sansar.Script.SessionId](/scripting/api/sansar.script/sessionid) | The session id of the agent to find. |

**Returns:** [AgentPrivate](/scripting/api/sansar.simulation/agentprivate) — The agent, or null if an agent cannot be found with that id in the scene.

<details class="api-remarks"><summary>Remarks</summary>

Agents may leave at any time. Attempting to use an Agent or AgentInfo interface for an agent no longer in the scene will throw a NullReferenceException.

</details>

</div>

<div class="api-card" id="findagent-guid">
<span id="M:Sansar.Simulation.ScenePrivate.FindAgent(System.Guid)"></span>

```csharp signature
public AgentPrivate FindAgent(Guid personaId)
```

Looks up an Agent associated with the given persona id, if they are in the scene.

| Parameter | Type | Description |
|---|---|---|
| `personaId` | [Guid](https://learn.microsoft.com/dotnet/api/system.guid) | The object to find. |

**Returns:** [AgentPrivate](/scripting/api/sansar.simulation/agentprivate) — The agent, or null if an agent cannot be found with that id in the scene.

<details class="api-remarks"><summary>Remarks</summary>

Agents may leave at any time. Attempting to use an Agent or AgentInfo interface for an agent no longer in the scene will throw a NullReferenceException.

</details>

</div>

### FindObject

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.FindObject(Sansar.Script.ObjectId)"></span>

```csharp signature
public ObjectPrivate FindObject(Sansar.Script.ObjectId objectId)
```

Looks up a Object associated with the given object id.

| Parameter | Type | Description |
|---|---|---|
| `objectId` | [Sansar.Script.ObjectId](/scripting/api/sansar.script/objectid) | The object to find. |

**Returns:** [ObjectPrivate](/scripting/api/sansar.simulation/objectprivate) — The ObjectPrivate, or null if a Object cannot be found with that id.

</div>

### FindReflective

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.FindReflective``1(System.String)"></span>

```csharp signature
[Sansar.Script.NonReflective]
public IEnumerable<TInterface> FindReflective<TInterface>(
    string name
) where TInterface : class
```

Looks up Reflective objects in the scene that match the interface type by class name.

| Parameter | Type | Description |
|---|---|---|
| `name` | [string](https://learn.microsoft.com/dotnet/api/system.string) | The type name of the object&#39;s class to find. |

**Type parameters:** `TInterface`: The interface type to find.

**Returns:** [IEnumerable&lt;TInterface&gt;](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1) — An IEnumerable which contains all objects of the given type name that match the given interface.

<details class="api-remarks"><summary>Remarks</summary>

The name given corresponds to the `Type.FullName` of the object. Multiple scripts may define unrelated types of the same name, but only registered objects that match the interface of TInterface will be returned.

</details>

</div>

### FindScript

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.FindScript(Sansar.Script.ScriptId)"></span>

```csharp signature
public object FindScript(Sansar.Script.ScriptId scriptId)
```

Looks up the script object associated with the given scriptId

| Parameter | Type | Description |
|---|---|---|
| `scriptId` | [Sansar.Script.ScriptId](/scripting/api/sansar.script/scriptid) | The scriptId of the object to find. |

**Returns:** [object](https://learn.microsoft.com/dotnet/api/system.object) — The script object, or null if an script cannot be found with that id in the scene.

<details class="api-remarks"><summary>Remarks</summary>

Objects and their associated scripts may be removed the scene at any time.

</details>

</div>

### GetAgent

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.GetAgent(System.UInt32)"></span>

```csharp signature
public AgentPrivate GetAgent(uint index)
```

Get an [`AgentPrivate`](/scripting/api/sansar.simulation/agentprivate) for a specific agent in the Scene.

| Parameter | Type | Description |
|---|---|---|
| `index` | [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | The index of the agent to get. |

**Returns:** [AgentPrivate](/scripting/api/sansar.simulation/agentprivate) — Returns null if the index is larger than the number of agents in the Scene, or if the agent is not fully loaded.

<details class="api-remarks"><summary>Remarks</summary>

Agents may appear at different indices as they join and part.

</details>

</div>

### GetAgents

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.GetAgents"></span>
<span id="M:Sansar.Simulation.ScenePrivate.GetAgents()"></span>

```csharp signature
public IEnumerable<AgentPrivate> GetAgents()
```

Returns the current list of Agents in the Scene.

**Returns:** [IEnumerable&lt;AgentPrivate&gt;](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1) — The current list of agents in the Scene

</div>

### GetAllowFlight

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.GetAllowFlight"></span>
<span id="M:Sansar.Simulation.ScenePrivate.GetAllowFlight()"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public bool GetAllowFlight()
```

Gets the flight availability default for this scene instance.

**Returns:** [bool](https://learn.microsoft.com/dotnet/api/system.boolean) — The instance default, before per-agent overrides.

<details class="api-remarks"><summary>Remarks</summary>

Flight settings are per instance: they are not saved to the world or shared with clone regions.

</details>

</div>

### GetBoxClosestPoints

<div class="api-card" id="getboxclosestpoints-vector-vector-single">
<span id="M:Sansar.Simulation.ScenePrivate.GetBoxClosestPoints(Sansar.Vector,Sansar.Vector,System.Single)"></span>

```csharp signature
public RayCastHit[] GetBoxClosestPoints(
    Sansar.Vector halfExtents,
    Sansar.Vector origin,
    float maximumDistance
)
```

Extends a box with the given half extents the maximum distance and returns any hits.

| Parameter | Type | Description |
|---|---|---|
| `halfExtents` | [Sansar.Vector](/scripting/api/sansar/vector) | The x,y,z distance from the center of the box to the corresponding face. |
| `origin` | [Sansar.Vector](/scripting/api/sansar/vector) | The center of the query. |
| `maximumDistance` | [float](https://learn.microsoft.com/dotnet/api/system.single) | the maximum distance from the origin to check. |

**Returns:** [RayCastHit](/scripting/api/sansar.simulation/raycasthit)\[\]

</div>

<div class="api-card" id="getboxclosestpoints-vector-vector-quaternion-single">
<span id="M:Sansar.Simulation.ScenePrivate.GetBoxClosestPoints(Sansar.Vector,Sansar.Vector,Sansar.Quaternion,System.Single)"></span>

```csharp signature
public RayCastHit[] GetBoxClosestPoints(
    Sansar.Vector halfExtents,
    Sansar.Vector origin,
    Sansar.Quaternion orientation,
    float maximumDistance
)
```

Extends a box with the given half extents the maximum distance and returns any hits.

| Parameter | Type | Description |
|---|---|---|
| `halfExtents` | [Sansar.Vector](/scripting/api/sansar/vector) | The x,y,z distance from the center of the box to the corresponding face. |
| `origin` | [Sansar.Vector](/scripting/api/sansar/vector) | The center of the query. |
| `orientation` | [Sansar.Quaternion](/scripting/api/sansar/quaternion) | The orientation of the query shape. |
| `maximumDistance` | [float](https://learn.microsoft.com/dotnet/api/system.single) | the maximum distance from the origin to check. |

**Returns:** [RayCastHit](/scripting/api/sansar.simulation/raycasthit)\[\] — An array of hit results, ordered from nearest to furthest. If the cast did not hit anything the array will be empty.

</div>

<div class="api-card" id="getboxclosestpoints-vector-vector-single-int32">
<span id="M:Sansar.Simulation.ScenePrivate.GetBoxClosestPoints(Sansar.Vector,Sansar.Vector,System.Single,System.Int32)"></span>

```csharp signature
public RayCastHit[] GetBoxClosestPoints(
    Sansar.Vector halfExtents,
    Sansar.Vector origin,
    float maximumDistance,
    int maxHits
)
```

Extends a box with the given half extents the maximum distance and returns any hits.

| Parameter | Type | Description |
|---|---|---|
| `halfExtents` | [Sansar.Vector](/scripting/api/sansar/vector) | The x,y,z distance from the center of the box to the corresponding face. |
| `origin` | [Sansar.Vector](/scripting/api/sansar/vector) | The center of the query. |
| `maximumDistance` | [float](https://learn.microsoft.com/dotnet/api/system.single) | the maximum distance from the origin to check. |
| `maxHits` | [int](https://learn.microsoft.com/dotnet/api/system.int32) | Limit the number of results returned. |

**Returns:** [RayCastHit](/scripting/api/sansar.simulation/raycasthit)\[\]

</div>

<div class="api-card" id="getboxclosestpoints-vector-vector-quaternion-single-int32">
<span id="M:Sansar.Simulation.ScenePrivate.GetBoxClosestPoints(Sansar.Vector,Sansar.Vector,Sansar.Quaternion,System.Single,System.Int32)"></span>

```csharp signature
public RayCastHit[] GetBoxClosestPoints(
    Sansar.Vector halfExtents,
    Sansar.Vector origin,
    Sansar.Quaternion orientation,
    float maximumDistance,
    int maxHits
)
```

Extends a box with the given half extents the maximum distance and returns any hits.

| Parameter | Type | Description |
|---|---|---|
| `halfExtents` | [Sansar.Vector](/scripting/api/sansar/vector) | The x,y,z distance from the center of the box to the corresponding face. |
| `origin` | [Sansar.Vector](/scripting/api/sansar/vector) | The center of the query. |
| `orientation` | [Sansar.Quaternion](/scripting/api/sansar/quaternion) | The orientation of the query shape. |
| `maximumDistance` | [float](https://learn.microsoft.com/dotnet/api/system.single) | the maximum distance from the origin to check. |
| `maxHits` | [int](https://learn.microsoft.com/dotnet/api/system.int32) | Limit the number of results returned. |

**Returns:** [RayCastHit](/scripting/api/sansar.simulation/raycasthit)\[\] — An array of hit results, ordered from nearest to furthest. If the cast did not hit anything the array will be empty.

</div>

### GetCapsuleClosestPoints

<div class="api-card" id="getcapsuleclosestpoints-vector-vector-single-vector-single">
<span id="M:Sansar.Simulation.ScenePrivate.GetCapsuleClosestPoints(Sansar.Vector,Sansar.Vector,System.Single,Sansar.Vector,System.Single)"></span>

```csharp signature
public RayCastHit[] GetCapsuleClosestPoints(
    Sansar.Vector capsuleStart,
    Sansar.Vector capsuleEnd,
    float capsuleRadius,
    Sansar.Vector origin,
    float maximumDistance
)
```

Extends a capsule with the given parameters the maximum distance and returns any hits.

| Parameter | Type | Description |
|---|---|---|
| `capsuleStart` | [Sansar.Vector](/scripting/api/sansar/vector) | The base point of the capsule. |
| `capsuleEnd` | [Sansar.Vector](/scripting/api/sansar/vector) | The end point of the capsule. |
| `capsuleRadius` | [float](https://learn.microsoft.com/dotnet/api/system.single) | The radius of the capsule to query. |
| `origin` | [Sansar.Vector](/scripting/api/sansar/vector) | The base of the capsule. |
| `maximumDistance` | [float](https://learn.microsoft.com/dotnet/api/system.single) | the maximum distance from the origin to check. |

**Returns:** [RayCastHit](/scripting/api/sansar.simulation/raycasthit)\[\]

</div>

<div class="api-card" id="getcapsuleclosestpoints-vector-vector-single-vector-quaternion-single">
<span id="M:Sansar.Simulation.ScenePrivate.GetCapsuleClosestPoints(Sansar.Vector,Sansar.Vector,System.Single,Sansar.Vector,Sansar.Quaternion,System.Single)"></span>

```csharp signature
public RayCastHit[] GetCapsuleClosestPoints(
    Sansar.Vector capsuleStart,
    Sansar.Vector capsuleEnd,
    float capsuleRadius,
    Sansar.Vector origin,
    Sansar.Quaternion orientation,
    float maximumDistance
)
```

Extends a capsule with the given parameters the maximum distance and returns any hits.

| Parameter | Type | Description |
|---|---|---|
| `capsuleStart` | [Sansar.Vector](/scripting/api/sansar/vector) | The base point of the capsule. |
| `capsuleEnd` | [Sansar.Vector](/scripting/api/sansar/vector) | The end point of the capsule. |
| `capsuleRadius` | [float](https://learn.microsoft.com/dotnet/api/system.single) | The radius of the capsule to query. |
| `origin` | [Sansar.Vector](/scripting/api/sansar/vector) | The base of the capsule. |
| `orientation` | [Sansar.Quaternion](/scripting/api/sansar/quaternion) | The orientation of the query shape. |
| `maximumDistance` | [float](https://learn.microsoft.com/dotnet/api/system.single) | the maximum distance from the origin to check. |

**Returns:** [RayCastHit](/scripting/api/sansar.simulation/raycasthit)\[\]

</div>

<div class="api-card" id="getcapsuleclosestpoints-vector-vector-single-vector-single-int32">
<span id="M:Sansar.Simulation.ScenePrivate.GetCapsuleClosestPoints(Sansar.Vector,Sansar.Vector,System.Single,Sansar.Vector,System.Single,System.Int32)"></span>

```csharp signature
public RayCastHit[] GetCapsuleClosestPoints(
    Sansar.Vector capsuleStart,
    Sansar.Vector capsuleEnd,
    float capsuleRadius,
    Sansar.Vector origin,
    float maximumDistance,
    int maxHits
)
```

Extends a capsule with the given parameters the maximum distance and returns any hits.

| Parameter | Type | Description |
|---|---|---|
| `capsuleStart` | [Sansar.Vector](/scripting/api/sansar/vector) | The base point of the capsule. |
| `capsuleEnd` | [Sansar.Vector](/scripting/api/sansar/vector) | The end point of the capsule. |
| `capsuleRadius` | [float](https://learn.microsoft.com/dotnet/api/system.single) | The radius of the capsule to query. |
| `origin` | [Sansar.Vector](/scripting/api/sansar/vector) | The base of the capsule. |
| `maximumDistance` | [float](https://learn.microsoft.com/dotnet/api/system.single) | the maximum distance from the origin to check. |
| `maxHits` | [int](https://learn.microsoft.com/dotnet/api/system.int32) | Limit the number of results returned. |

**Returns:** [RayCastHit](/scripting/api/sansar.simulation/raycasthit)\[\]

</div>

<div class="api-card" id="getcapsuleclosestpoints-vector-vector-single-vector-quaternion-single-int32">
<span id="M:Sansar.Simulation.ScenePrivate.GetCapsuleClosestPoints(Sansar.Vector,Sansar.Vector,System.Single,Sansar.Vector,Sansar.Quaternion,System.Single,System.Int32)"></span>

```csharp signature
public RayCastHit[] GetCapsuleClosestPoints(
    Sansar.Vector capsuleStart,
    Sansar.Vector capsuleEnd,
    float capsuleRadius,
    Sansar.Vector origin,
    Sansar.Quaternion orientation,
    float maximumDistance,
    int maxHits
)
```

Extends a capsule with the given parameters the maximum distance and returns any hits.

| Parameter | Type | Description |
|---|---|---|
| `capsuleStart` | [Sansar.Vector](/scripting/api/sansar/vector) | The base point of the capsule. |
| `capsuleEnd` | [Sansar.Vector](/scripting/api/sansar/vector) | The end point of the capsule. |
| `capsuleRadius` | [float](https://learn.microsoft.com/dotnet/api/system.single) | The radius of the capsule to query. |
| `origin` | [Sansar.Vector](/scripting/api/sansar/vector) | The base of the capsule. |
| `orientation` | [Sansar.Quaternion](/scripting/api/sansar/quaternion) | The orientation of the query shape. |
| `maximumDistance` | [float](https://learn.microsoft.com/dotnet/api/system.single) | the maximum distance from the origin to check. |
| `maxHits` | [int](https://learn.microsoft.com/dotnet/api/system.int32) | Limit the number of results returned. |

**Returns:** [RayCastHit](/scripting/api/sansar.simulation/raycasthit)\[\]

</div>

### GetGravity

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.GetGravity"></span>
<span id="M:Sansar.Simulation.ScenePrivate.GetGravity()"></span>

```csharp signature
public float GetGravity()
```

Gets the scene&#39;s current acceleration of gravity in m/s^2.

**Returns:** [float](https://learn.microsoft.com/dotnet/api/system.single) — Number indicating the magnitude of gravity in the scene.

<details class="api-remarks"><summary>Remarks</summary>

The default gravity for the scene is [`ScenePrivate.DefaultGravity`](/scripting/api/sansar.simulation/sceneprivate#defaultgravity)

</details>

<details class="api-example" open><summary>Example</summary>

```csharp
float currentGravity = ScenePrivate.GetGravity(); // Get the current scene gravity in m/s^2
```

</details>

</div>

### GetPortalCreatorName

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.GetPortalCreatorName(Sansar.Script.ObjectId)"></span>

```csharp signature
public string GetPortalCreatorName(Sansar.Script.ObjectId objectId)
```

The name of the user who created the specified portal.

| Parameter | Type | Description |
|---|---|---|
| `objectId` | [Sansar.Script.ObjectId](/scripting/api/sansar.script/objectid) |  |

**Returns:** [string](https://learn.microsoft.com/dotnet/api/system.string) — String

<details class="api-remarks"><summary>Remarks</summary>

User who created the portal.

</details>

</div>

### GetPortalDescription

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.GetPortalDescription(Sansar.Script.ObjectId)"></span>

```csharp signature
public string GetPortalDescription(Sansar.Script.ObjectId objectId)
```

Description for the specified portal.

| Parameter | Type | Description |
|---|---|---|
| `objectId` | [Sansar.Script.ObjectId](/scripting/api/sansar.script/objectid) |  |

**Returns:** [string](https://learn.microsoft.com/dotnet/api/system.string) — String

<details class="api-remarks"><summary>Remarks</summary>

The description of the portal.

</details>

</div>

### GetPortalUri

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.GetPortalUri(Sansar.Script.ObjectId)"></span>

```csharp signature
public string GetPortalUri(Sansar.Script.ObjectId objectId)
```

URI destination for the specified portal.

| Parameter | Type | Description |
|---|---|---|
| `objectId` | [Sansar.Script.ObjectId](/scripting/api/sansar.script/objectid) |  |

**Returns:** [string](https://learn.microsoft.com/dotnet/api/system.string) — String

<details class="api-remarks"><summary>Remarks</summary>

The URI of the destination of the portal.

</details>

</div>

### GetSphereClosestPoints

<div class="api-card" id="getsphereclosestpoints-single-vector-single">
<span id="M:Sansar.Simulation.ScenePrivate.GetSphereClosestPoints(System.Single,Sansar.Vector,System.Single)"></span>

```csharp signature
public RayCastHit[] GetSphereClosestPoints(
    float radius,
    Sansar.Vector origin,
    float maximumDistance
)
```

Extends a sphere with the given radius the maximum distance and returns any hits.

| Parameter | Type | Description |
|---|---|---|
| `radius` | [float](https://learn.microsoft.com/dotnet/api/system.single) | The radius of the sphere to query. |
| `origin` | [Sansar.Vector](/scripting/api/sansar/vector) | The center of the query. |
| `maximumDistance` | [float](https://learn.microsoft.com/dotnet/api/system.single) | the maximum distance from the origin to check. |

**Returns:** [RayCastHit](/scripting/api/sansar.simulation/raycasthit)\[\]

</div>

<div class="api-card" id="getsphereclosestpoints-single-vector-single-int32">
<span id="M:Sansar.Simulation.ScenePrivate.GetSphereClosestPoints(System.Single,Sansar.Vector,System.Single,System.Int32)"></span>

```csharp signature
public RayCastHit[] GetSphereClosestPoints(
    float radius,
    Sansar.Vector origin,
    float maximumDistance,
    int maxHits
)
```

Extends a sphere with the given radius the maximum distance and returns any hits.

| Parameter | Type | Description |
|---|---|---|
| `radius` | [float](https://learn.microsoft.com/dotnet/api/system.single) | The radius of the sphere to query. |
| `origin` | [Sansar.Vector](/scripting/api/sansar/vector) | The center of the query. |
| `maximumDistance` | [float](https://learn.microsoft.com/dotnet/api/system.single) | the maximum distance from the origin to check. |
| `maxHits` | [int](https://learn.microsoft.com/dotnet/api/system.int32) | Limit the number of results returned. |

**Returns:** [RayCastHit](/scripting/api/sansar.simulation/raycasthit)\[\]

</div>

### GetTimeOfDay

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.GetTimeOfDay"></span>
<span id="M:Sansar.Simulation.ScenePrivate.GetTimeOfDay()"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public float GetTimeOfDay()
```

Gets the scene&#39;s current time of day in hours.

**Returns:** [float](https://learn.microsoft.com/dotnet/api/system.single) — The time of day in hours, from 0 up to 24.

<details class="api-remarks"><summary>Remarks</summary>

The scene clock runs from 0 at midnight up to 24, so 13.5 is half past one in the afternoon. With the mode [`TimeOfDayMode.Off`](/scripting/api/sansar.simulation/timeofdaymode#F:Sansar.Simulation.TimeOfDayMode.Off) this is the time set in the scene settings, which has no effect on the scene until the mode is [`TimeOfDayMode.Fixed`](/scripting/api/sansar.simulation/timeofdaymode#F:Sansar.Simulation.TimeOfDayMode.Fixed) or [`TimeOfDayMode.Cycle`](/scripting/api/sansar.simulation/timeofdaymode#F:Sansar.Simulation.TimeOfDayMode.Cycle).

</details>

<details class="api-example" open><summary>Example</summary>

```csharp
float hours = ScenePrivate.GetTimeOfDay(); // Get the scene clock in hours
```

</details>

</div>

### GetTimeOfDayMode

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.GetTimeOfDayMode"></span>
<span id="M:Sansar.Simulation.ScenePrivate.GetTimeOfDayMode()"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public TimeOfDayMode GetTimeOfDayMode()
```

Gets how the scene&#39;s time of day runs.

**Returns:** [TimeOfDayMode](/scripting/api/sansar.simulation/timeofdaymode) — The current [`TimeOfDayMode`](/scripting/api/sansar.simulation/timeofdaymode).

<details class="api-remarks"><summary>Remarks</summary>

See TimeOfDayExample.cs in the Examples folder for more details.

</details>

<details class="api-example" open><summary>Example</summary>

```csharp
bool dayNight = ScenePrivate.GetTimeOfDayMode() != TimeOfDayMode.Off; // Is the time of day in effect?
```

</details>

</div>

### OverrideAudioStream

<div class="api-card" id="overrideaudiostream-string">
<span id="M:Sansar.Simulation.ScenePrivate.OverrideAudioStream(System.String)"></span>

```csharp signature
public void OverrideAudioStream(string url)
```

Overrides source of web audio streams.

| Parameter | Type | Description |
|---|---|---|
| `url` | [string](https://learn.microsoft.com/dotnet/api/system.string) | URL to use. |

<details class="api-remarks"><summary>Remarks</summary>

Applies to all agents in this scene.  NOTE: this may cause a few seconds of silence while restarting the stream.  To avoid silence, assign URLs in your SceneSettings instead, which will pre-load them.

</details>

</div>

<div class="api-card" id="overrideaudiostream-string-action">
<span id="M:Sansar.Simulation.ScenePrivate.OverrideAudioStream(System.String,System.Action{Sansar.Script.OperationCompleteEvent})"></span>

```csharp signature
public void OverrideAudioStream(
    string url,
    Action<Sansar.Script.OperationCompleteEvent> handler
)
```

Overrides source of web audio streams.

| Parameter | Type | Description |
|---|---|---|
| `url` | [string](https://learn.microsoft.com/dotnet/api/system.string) | URL to use. |
| `handler` | [Action&lt;Sansar.Script.OperationCompleteEvent&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

<details class="api-remarks"><summary>Remarks</summary>

Applies to all agents in this scene.  NOTE: this may cause a few seconds of silence while restarting the stream.  To avoid silence, assign URLs in your SceneSettings instead, which will pre-load them.

</details>

</div>

### OverrideIndexedMediaSource

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.OverrideIndexedMediaSource(System.String,System.Int32,System.Int32,System.Int32,System.Action{Sansar.Script.OperationCompleteEvent})"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 46.5.0</span></div>

```csharp signature
public void OverrideIndexedMediaSource(
    string url,
    int mediaIndex,
    int mediaWidth,
    int mediaHeight,
    Action<Sansar.Script.OperationCompleteEvent> handler
)
```

Overrides source of indexed media surfaces.

| Parameter | Type | Description |
|---|---|---|
| `url` | [string](https://learn.microsoft.com/dotnet/api/system.string) | URL to use. |
| `mediaIndex` | [int](https://learn.microsoft.com/dotnet/api/system.int32) | (cMediaChannel only) source index. |
| `mediaWidth` | [int](https://learn.microsoft.com/dotnet/api/system.int32) | (cMediaChannel only) source width. |
| `mediaHeight` | [int](https://learn.microsoft.com/dotnet/api/system.int32) | (cMediaChannel only) source height. |
| `handler` | [Action&lt;Sansar.Script.OperationCompleteEvent&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

<details class="api-remarks"><summary>Remarks</summary>

Applies to all agents in this scene.  NOTE: this will cause a few seconds of silence while restarting the stream.  To avoid silence, assign URLs in your SceneSettings instead, which will pre-load them.

</details>

</div>

### OverrideMediaSource

<div class="api-card" id="overridemediasource-string">
<span id="M:Sansar.Simulation.ScenePrivate.OverrideMediaSource(System.String)"></span>

```csharp signature
public void OverrideMediaSource(string url)
```

Sets stream channel source.

| Parameter | Type | Description |
|---|---|---|
| `url` | [string](https://learn.microsoft.com/dotnet/api/system.string) | URL to use. |

</div>

<div class="api-card" id="overridemediasource-string-int32-int32">
<span id="M:Sansar.Simulation.ScenePrivate.OverrideMediaSource(System.String,System.Int32,System.Int32)"></span>

```csharp signature
public void OverrideMediaSource(
    string url,
    int mediaWidth,
    int mediaHeight
)
```

Overrides source of media surfaces.

| Parameter | Type | Description |
|---|---|---|
| `url` | [string](https://learn.microsoft.com/dotnet/api/system.string) | URL to use. |
| `mediaWidth` | [int](https://learn.microsoft.com/dotnet/api/system.int32) | (cMediaChannel only) source width. |
| `mediaHeight` | [int](https://learn.microsoft.com/dotnet/api/system.int32) | (cMediaChannel only) source height. |

<details class="api-remarks"><summary>Remarks</summary>

Applies to all agents in this scene.  NOTE: this will cause a few seconds of silence while restarting starting the stream.  To avoid silence, assign URLs in your SceneSettings instead, which will pre-load them.

</details>

</div>

<div class="api-card" id="overridemediasource-string-int32-int32-action">
<span id="M:Sansar.Simulation.ScenePrivate.OverrideMediaSource(System.String,System.Int32,System.Int32,System.Action{Sansar.Script.OperationCompleteEvent})"></span>

```csharp signature
public void OverrideMediaSource(
    string url,
    int mediaWidth,
    int mediaHeight,
    Action<Sansar.Script.OperationCompleteEvent> handler
)
```

Overrides source of media surfaces.

| Parameter | Type | Description |
|---|---|---|
| `url` | [string](https://learn.microsoft.com/dotnet/api/system.string) | URL to use. |
| `mediaWidth` | [int](https://learn.microsoft.com/dotnet/api/system.int32) | (cMediaChannel only) source width. |
| `mediaHeight` | [int](https://learn.microsoft.com/dotnet/api/system.int32) | (cMediaChannel only) source height. |
| `handler` | [Action&lt;Sansar.Script.OperationCompleteEvent&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

<details class="api-remarks"><summary>Remarks</summary>

Applies to all agents in this scene.  NOTE: this will cause a few seconds of silence while restarting the stream.  To avoid silence, assign URLs in your SceneSettings instead, which will pre-load them.

</details>

</div>

### PerformIndexedMediaAction

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.PerformIndexedMediaAction(Sansar.Simulation.MediaAction,System.Int32,System.Action{Sansar.Script.OperationCompleteEvent})"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 46.5.0</span></div>

```csharp signature
public void PerformIndexedMediaAction(
    MediaAction action,
    int mediaIndex,
    Action<Sansar.Script.OperationCompleteEvent> handler
)
```

Performs a specific action on the current media surface index.

| Parameter | Type | Description |
|---|---|---|
| `action` | [MediaAction](/scripting/api/sansar.simulation/mediaaction) | The action to perform. |
| `mediaIndex` | [int](https://learn.microsoft.com/dotnet/api/system.int32) | (cMediaChannel only) source index. |
| `handler` | [Action&lt;Sansar.Script.OperationCompleteEvent&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

<details class="api-remarks"><summary>Remarks</summary>

Applies to all agents currently in the scene.

</details>

</div>

### PerformMediaAction

<div class="api-card" id="performmediaaction-mediaaction">
<span id="M:Sansar.Simulation.ScenePrivate.PerformMediaAction(Sansar.Simulation.MediaAction)"></span>

```csharp signature
public void PerformMediaAction(MediaAction action)
```

Performs a specific action on the current media surface.

| Parameter | Type | Description |
|---|---|---|
| `action` | [MediaAction](/scripting/api/sansar.simulation/mediaaction) | The action to perform. |

<details class="api-remarks"><summary>Remarks</summary>

Applies to this agent only.

</details>

</div>

<div class="api-card" id="performmediaaction-mediaaction-action">
<span id="M:Sansar.Simulation.ScenePrivate.PerformMediaAction(Sansar.Simulation.MediaAction,System.Action{Sansar.Script.OperationCompleteEvent})"></span>

```csharp signature
public void PerformMediaAction(
    MediaAction action,
    Action<Sansar.Script.OperationCompleteEvent> handler
)
```

Performs a specific action on the current media surface.

| Parameter | Type | Description |
|---|---|---|
| `action` | [MediaAction](/scripting/api/sansar.simulation/mediaaction) | The action to perform. |
| `handler` | [Action&lt;Sansar.Script.OperationCompleteEvent&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

<details class="api-remarks"><summary>Remarks</summary>

Applies to all agents currently in the scene.

</details>

</div>

### PlaySound

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.PlaySound(Sansar.Simulation.SoundResource,Sansar.Simulation.PlaySettings)"></span>

```csharp signature
public PlayHandle PlaySound(
    SoundResource soundResource,
    PlaySettings playSettings
)
```

Play sound to direct output.

| Parameter | Type | Description |
|---|---|---|
| `soundResource` | [SoundResource](/scripting/api/sansar.simulation/soundresource) | The sound resource to play. |
| `playSettings` | [PlaySettings](/scripting/api/sansar.simulation/playsettings) | The play parameters. |

**Returns:** [PlayHandle](/scripting/api/sansar.simulation/playhandle) — The play handle for controlling playback.

<details class="api-remarks"><summary>Remarks</summary>

Plays for all agents in this scene.

</details>

</div>

### PlaySoundAtPosition

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.PlaySoundAtPosition(Sansar.Simulation.SoundResource,Sansar.Vector,Sansar.Simulation.PlaySettings)"></span>

```csharp signature
public PlayHandle PlaySoundAtPosition(
    SoundResource soundResource,
    Sansar.Vector position,
    PlaySettings playSettings
)
```

Play sound at specified position.

| Parameter | Type | Description |
|---|---|---|
| `soundResource` | [SoundResource](/scripting/api/sansar.simulation/soundresource) | The sound resource to play. |
| `position` | [Sansar.Vector](/scripting/api/sansar/vector) | The absolute position. |
| `playSettings` | [PlaySettings](/scripting/api/sansar.simulation/playsettings) | The play parameters. |

**Returns:** [PlayHandle](/scripting/api/sansar.simulation/playhandle) — The play handle for controlling playback.

<details class="api-remarks"><summary>Remarks</summary>

Plays for all agents in this scene.  By setting an absolute position, the location of this sound will be static.  If you want the sound to move, you must play the sound on an audio component and move the audio component.

</details>

</div>

### PlayStream

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.PlayStream(Sansar.Simulation.StreamChannel,System.Single)"></span>

```csharp signature
public PlayHandle PlayStream(
    StreamChannel streamChannel,
    float loudness
)
```

Play web audio stream to direct output.

| Parameter | Type | Description |
|---|---|---|
| `streamChannel` | [StreamChannel](/scripting/api/sansar.simulation/streamchannel) | Channel of the audio stream to play. |
| `loudness` | [float](https://learn.microsoft.com/dotnet/api/system.single) | Relative loudness in dB. |

**Returns:** [PlayHandle](/scripting/api/sansar.simulation/playhandle) — The play handle for controlling playback.

<details class="api-remarks"><summary>Remarks</summary>

Plays for all agents in this scene.

</details>

</div>

### PlayStreamAtPosition

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.PlayStreamAtPosition(Sansar.Simulation.StreamChannel,Sansar.Vector,System.Single)"></span>

```csharp signature
public PlayHandle PlayStreamAtPosition(
    StreamChannel streamChannel,
    Sansar.Vector position,
    float loudness
)
```

Play web audio stream at specified position.

| Parameter | Type | Description |
|---|---|---|
| `streamChannel` | [StreamChannel](/scripting/api/sansar.simulation/streamchannel) | Channel of the audio stream to play. |
| `position` | [Sansar.Vector](/scripting/api/sansar/vector) | The absolute position. |
| `loudness` | [float](https://learn.microsoft.com/dotnet/api/system.single) | Relative loudness in dB. |

**Returns:** [PlayHandle](/scripting/api/sansar.simulation/playhandle) — The play handle for controlling playback.

<details class="api-remarks"><summary>Remarks</summary>

Plays for all agents in this scene.  By setting an absolute position, the location of this sound will be static.  If you want the sound to move, you must play the sound on an audio component and move the audio component.

</details>

</div>

### RemoveFromSceneLibrary

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.RemoveFromSceneLibrary(Sansar.Simulation.ClusterResource)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 47.1.1</span></div>

```csharp signature
public void RemoveFromSceneLibrary(ClusterResource resource)
```

Remove an item from the scene library for all users.

| Parameter | Type | Description |
|---|---|---|
| `resource` | [ClusterResource](/scripting/api/sansar.simulation/clusterresource) | The cluster resource to remove. |

</div>

### RemoveFromSceneLibraryForAgent

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.RemoveFromSceneLibraryForAgent(Sansar.Simulation.AgentPrivate,Sansar.Simulation.ClusterResource)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 47.1.1</span></div>

```csharp signature
public void RemoveFromSceneLibraryForAgent(
    AgentPrivate agent,
    ClusterResource resource
)
```

Remove an item from the scene library for a specific agent.

| Parameter | Type | Description |
|---|---|---|
| `agent` | [AgentPrivate](/scripting/api/sansar.simulation/agentprivate) | The target agent. |
| `resource` | [ClusterResource](/scripting/api/sansar.simulation/clusterresource) | The cluster resource to remove. |

</div>

### ResetScene

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.ResetScene"></span>
<span id="M:Sansar.Simulation.ScenePrivate.ResetScene()"></span>

```csharp signature
[Sansar.Script.Interface(Restricted=true)]
public void ResetScene()
```

Restarts the Scene.

<details class="api-remarks"><summary>Remarks</summary>

All clients will be momentarily disconnected.

</details>

</div>

### SetAllowFlight

<div class="api-card" id="setallowflight-boolean">
<span id="M:Sansar.Simulation.ScenePrivate.SetAllowFlight(System.Boolean)"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public void SetAllowFlight(bool allowFlight)
```

Sets the flight availability default for this scene instance.

| Parameter | Type | Description |
|---|---|---|
| `allowFlight` | [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | The default for agents without an explicit override. |

<details class="api-remarks"><summary>Remarks</summary>

Existing overrides persist until cleared or the agent leaves. This instance-only setting is not saved to the world or shared with clone regions. The write is queued for the next world update. The callback, or [`ScriptBase.WaitFor`](/scripting/api/sansar.script/scriptbase#waitfor) in a coroutine, reports whether the server committed the change and queued client updates, not client acknowledgment.

</details>

</div>

<div class="api-card" id="setallowflight-boolean-action">
<span id="M:Sansar.Simulation.ScenePrivate.SetAllowFlight(System.Boolean,System.Action{Sansar.Script.OperationCompleteEvent})"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public void SetAllowFlight(
    bool allowFlight,
    Action<Sansar.Script.OperationCompleteEvent> handler
)
```

Sets the flight availability default for this scene instance.

| Parameter | Type | Description |
|---|---|---|
| `allowFlight` | [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | The default for agents without an explicit override. |
| `handler` | [Action&lt;Sansar.Script.OperationCompleteEvent&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

<details class="api-remarks"><summary>Remarks</summary>

Existing overrides persist until cleared or the agent leaves. This instance-only setting is not saved to the world or shared with clone regions. The write is queued for the next world update. The callback, or [`ScriptBase.WaitFor`](/scripting/api/sansar.script/scriptbase#waitfor) in a coroutine, reports whether the server committed the change and queued client updates, not client acknowledgment.

</details>

</div>

### SetColorLut

<div class="api-card" id="setcolorlut-textureresource">
<span id="M:Sansar.Simulation.ScenePrivate.SetColorLut(Sansar.Simulation.TextureResource)"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public void SetColorLut(TextureResource lut)
```

Overrides the scene&#39;s color LUT for everyone in this scene instance.

| Parameter | Type | Description |
|---|---|---|
| `lut` | [TextureResource](/scripting/api/sansar.simulation/textureresource) | The LUT texture to grade with, or null to go back to the LUT chosen in the scene settings. |

<details class="api-remarks"><summary>Remarks</summary>

Every user without a per-agent override, see [`AgentPrivate.SetColorLut`](/scripting/api/sansar.simulation/agentprivate#setcolorlut-textureresource), is graded with this LUT in place of the scene settings LUT, including users who join later. A PostFX volume with its own LUT still takes over while a user&#39;s camera is inside it. This instance-only setting is not saved to the world or shared with clone regions. The write is queued for the next world update. The callback, or [`ScriptBase.WaitFor`](/scripting/api/sansar.script/scriptbase#waitfor) in a coroutine, reports whether the server committed the change and queued client updates, not client acknowledgment.

</details>

</div>

<div class="api-card" id="setcolorlut-textureresource-action">
<span id="M:Sansar.Simulation.ScenePrivate.SetColorLut(Sansar.Simulation.TextureResource,System.Action{Sansar.Script.OperationCompleteEvent})"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public void SetColorLut(
    TextureResource lut,
    Action<Sansar.Script.OperationCompleteEvent> handler
)
```

Overrides the scene&#39;s color LUT for everyone in this scene instance.

| Parameter | Type | Description |
|---|---|---|
| `lut` | [TextureResource](/scripting/api/sansar.simulation/textureresource) | The LUT texture to grade with, or null to go back to the LUT chosen in the scene settings. |
| `handler` | [Action&lt;Sansar.Script.OperationCompleteEvent&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

<details class="api-remarks"><summary>Remarks</summary>

Every user without a per-agent override, see [`AgentPrivate.SetColorLut`](/scripting/api/sansar.simulation/agentprivate#setcolorlut-textureresource), is graded with this LUT in place of the scene settings LUT, including users who join later. A PostFX volume with its own LUT still takes over while a user&#39;s camera is inside it. This instance-only setting is not saved to the world or shared with clone regions. The write is queued for the next world update. The callback, or [`ScriptBase.WaitFor`](/scripting/api/sansar.script/scriptbase#waitfor) in a coroutine, reports whether the server committed the change and queued client updates, not client acknowledgment.

</details>

</div>

### SetGravity

<div class="api-card" id="setgravity-single">
<span id="M:Sansar.Simulation.ScenePrivate.SetGravity(System.Single)"></span>

```csharp signature
public void SetGravity(float scale)
```

Sets the scene&#39;s current gravity acceleration in m/s^2.

| Parameter | Type | Description |
|---|---|---|
| `scale` | [float](https://learn.microsoft.com/dotnet/api/system.single) | The gravity magnitude. |

<details class="api-remarks"><summary>Remarks</summary>

Set to [`ScenePrivate.DefaultGravity`](/scripting/api/sansar.simulation/sceneprivate#defaultgravity) to return to the default. The valid range is from [`ScenePrivate.GravityMinimum`](/scripting/api/sansar.simulation/sceneprivate#gravityminimum) to [`ScenePrivate.GravityMaximum`](/scripting/api/sansar.simulation/sceneprivate#gravitymaximum). The direction cannot be changed.

</details>

<details class="api-example" open><summary>Example</summary>

```csharp
ScenePrivate.SetGravity(1.622f); // Set the scene to moon gravity
```

</details>

</div>

<div class="api-card" id="setgravity-single-operationcomplete">
<span id="M:Sansar.Simulation.ScenePrivate.SetGravity(System.Single,Sansar.Script.ScriptBase.OperationComplete)"></span>
<div class="api-badges"><span class="api-badge api-deprecated">Deprecated</span></div>

```csharp signature
[System.Obsolete("Deprecated. Use the Action<> overload", false)]
public ulong SetGravity(
    float scale,
    Sansar.Script.ScriptBase.OperationComplete handler
)
```

Sets the scene&#39;s current gravity acceleration in m/s^2.

| Parameter | Type | Description |
|---|---|---|
| `scale` | [float](https://learn.microsoft.com/dotnet/api/system.single) | The gravity magnitude. |
| `handler` | [Sansar.Script.ScriptBase.OperationComplete](/scripting/api/sansar.script/scriptbase.operationcomplete) | Handler to be called when the event completes. |

**Returns:** [ulong](https://learn.microsoft.com/dotnet/api/system.uint64) — The return value is an internal event id which can be passed to [`ScriptBase.WaitFor`](/scripting/api/sansar.script/scriptbase#waitfor) from a coroutine for synchronous behavior.

<details class="api-remarks"><summary>Remarks</summary>

Set to [`ScenePrivate.DefaultGravity`](/scripting/api/sansar.simulation/sceneprivate#defaultgravity) to return to the default. The valid range is from [`ScenePrivate.GravityMinimum`](/scripting/api/sansar.simulation/sceneprivate#gravityminimum) to [`ScenePrivate.GravityMaximum`](/scripting/api/sansar.simulation/sceneprivate#gravitymaximum). The direction cannot be changed.

</details>

<details class="api-example" open><summary>Example</summary>

```csharp
ScenePrivate.SetGravity(1.622f); // Set the scene to moon gravity
```

</details>

</div>

<div class="api-card" id="setgravity-single-action">
<span id="M:Sansar.Simulation.ScenePrivate.SetGravity(System.Single,System.Action{Sansar.Script.OperationCompleteEvent})"></span>

```csharp signature
public void SetGravity(
    float scale,
    Action<Sansar.Script.OperationCompleteEvent> handler
)
```

Sets the scene&#39;s current gravity acceleration in m/s^2.

| Parameter | Type | Description |
|---|---|---|
| `scale` | [float](https://learn.microsoft.com/dotnet/api/system.single) | The gravity magnitude. |
| `handler` | [Action&lt;Sansar.Script.OperationCompleteEvent&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

<details class="api-remarks"><summary>Remarks</summary>

Set to [`ScenePrivate.DefaultGravity`](/scripting/api/sansar.simulation/sceneprivate#defaultgravity) to return to the default. The valid range is from [`ScenePrivate.GravityMinimum`](/scripting/api/sansar.simulation/sceneprivate#gravityminimum) to [`ScenePrivate.GravityMaximum`](/scripting/api/sansar.simulation/sceneprivate#gravitymaximum). The direction cannot be changed.

</details>

<details class="api-example" open><summary>Example</summary>

```csharp
ScenePrivate.SetGravity(1.622f); // Set the scene to moon gravity
```

</details>

</div>

### SetMegaphone

<div class="api-card" id="setmegaphone-agentprivate-boolean">
<span id="M:Sansar.Simulation.ScenePrivate.SetMegaphone(Sansar.Simulation.AgentPrivate,System.Boolean)"></span>

```csharp signature
public void SetMegaphone(AgentPrivate agent, bool enable)
```

Sets the megaphone status of the user.

| Parameter | Type | Description |
|---|---|---|
| `agent` | [AgentPrivate](/scripting/api/sansar.simulation/agentprivate) | Agent to broadcast. |
| `enable` | [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | If true, user&#39;s voice will be heard by everyone in the scene.  If false, user&#39;s voice will be spatialized normally. |

</div>

<div class="api-card" id="setmegaphone-agentprivate-boolean-action">
<span id="M:Sansar.Simulation.ScenePrivate.SetMegaphone(Sansar.Simulation.AgentPrivate,System.Boolean,System.Action{Sansar.Script.OperationCompleteEvent})"></span>

```csharp signature
public void SetMegaphone(
    AgentPrivate agent,
    bool enable,
    Action<Sansar.Script.OperationCompleteEvent> handler
)
```

Sets the megaphone status of the user.

| Parameter | Type | Description |
|---|---|---|
| `agent` | [AgentPrivate](/scripting/api/sansar.simulation/agentprivate) | Agent to broadcast. |
| `enable` | [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | If true, user&#39;s voice will be heard by everyone in the scene.  If false, user&#39;s voice will be spatialized normally. |
| `handler` | [Action&lt;Sansar.Script.OperationCompleteEvent&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

</div>

### SetTimeOfDay

<div class="api-card" id="settimeofday-single">
<span id="M:Sansar.Simulation.ScenePrivate.SetTimeOfDay(System.Single)"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public void SetTimeOfDay(float hours)
```

Sets the scene&#39;s current time of day in hours.

| Parameter | Type | Description |
|---|---|---|
| `hours` | [float](https://learn.microsoft.com/dotnet/api/system.single) | The time of day in hours, from 0 at midnight up to 24. 18.5 is half past six in the evening. |

<details class="api-remarks"><summary>Remarks</summary>

Every user in the scene sees the change. With the mode [`TimeOfDayMode.Cycle`](/scripting/api/sansar.simulation/timeofdaymode#F:Sansar.Simulation.TimeOfDayMode.Cycle) the clock carries on running from the new time. The mode is left as it is: the time only takes effect while the mode is [`TimeOfDayMode.Fixed`](/scripting/api/sansar.simulation/timeofdaymode#F:Sansar.Simulation.TimeOfDayMode.Fixed) or [`TimeOfDayMode.Cycle`](/scripting/api/sansar.simulation/timeofdaymode#F:Sansar.Simulation.TimeOfDayMode.Cycle), see [`ScenePrivate.SetTimeOfDayMode`](/scripting/api/sansar.simulation/sceneprivate#settimeofdaymode-timeofdaymode).

</details>

<details class="api-example" open><summary>Example</summary>

```csharp
ScenePrivate.SetTimeOfDay(18.5f); // Half past six in the evening
```

</details>

</div>

<div class="api-card" id="settimeofday-single-action">
<span id="M:Sansar.Simulation.ScenePrivate.SetTimeOfDay(System.Single,System.Action{Sansar.Script.OperationCompleteEvent})"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public void SetTimeOfDay(
    float hours,
    Action<Sansar.Script.OperationCompleteEvent> handler
)
```

Sets the scene&#39;s current time of day in hours.

| Parameter | Type | Description |
|---|---|---|
| `hours` | [float](https://learn.microsoft.com/dotnet/api/system.single) | The time of day in hours, from 0 at midnight up to 24. 18.5 is half past six in the evening. |
| `handler` | [Action&lt;Sansar.Script.OperationCompleteEvent&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

<details class="api-remarks"><summary>Remarks</summary>

Every user in the scene sees the change. With the mode [`TimeOfDayMode.Cycle`](/scripting/api/sansar.simulation/timeofdaymode#F:Sansar.Simulation.TimeOfDayMode.Cycle) the clock carries on running from the new time. The mode is left as it is: the time only takes effect while the mode is [`TimeOfDayMode.Fixed`](/scripting/api/sansar.simulation/timeofdaymode#F:Sansar.Simulation.TimeOfDayMode.Fixed) or [`TimeOfDayMode.Cycle`](/scripting/api/sansar.simulation/timeofdaymode#F:Sansar.Simulation.TimeOfDayMode.Cycle), see [`ScenePrivate.SetTimeOfDayMode`](/scripting/api/sansar.simulation/sceneprivate#settimeofdaymode-timeofdaymode).

</details>

<details class="api-example" open><summary>Example</summary>

```csharp
ScenePrivate.SetTimeOfDay(18.5f); // Half past six in the evening
```

</details>

</div>

### SetTimeOfDayMode

<div class="api-card" id="settimeofdaymode-timeofdaymode">
<span id="M:Sansar.Simulation.ScenePrivate.SetTimeOfDayMode(Sansar.Simulation.TimeOfDayMode)"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public void SetTimeOfDayMode(TimeOfDayMode mode)
```

Sets how the scene&#39;s time of day runs.

| Parameter | Type | Description |
|---|---|---|
| `mode` | [TimeOfDayMode](/scripting/api/sansar.simulation/timeofdaymode) | The new mode. |

<details class="api-remarks"><summary>Remarks</summary>

Every user in the scene sees the change. The clock carries on from its current reading: switching from [`TimeOfDayMode.Cycle`](/scripting/api/sansar.simulation/timeofdaymode#F:Sansar.Simulation.TimeOfDayMode.Cycle) to [`TimeOfDayMode.Fixed`](/scripting/api/sansar.simulation/timeofdaymode#F:Sansar.Simulation.TimeOfDayMode.Fixed) holds the sun where it is, and switching back sets it moving again from there. A scene built with the mode [`TimeOfDayMode.Off`](/scripting/api/sansar.simulation/timeofdaymode#F:Sansar.Simulation.TimeOfDayMode.Off) has its sun baked into the lighting, so the bounced sunlight stays as built when a script turns the time of day on; build the scene with the mode [`TimeOfDayMode.Fixed`](/scripting/api/sansar.simulation/timeofdaymode#F:Sansar.Simulation.TimeOfDayMode.Fixed) or [`TimeOfDayMode.Cycle`](/scripting/api/sansar.simulation/timeofdaymode#F:Sansar.Simulation.TimeOfDayMode.Cycle) for the full effect.

</details>

<details class="api-example" open><summary>Example</summary>

```csharp
ScenePrivate.SetTimeOfDayMode(TimeOfDayMode.Cycle); // Start the day and night cycle
```

</details>

</div>

<div class="api-card" id="settimeofdaymode-timeofdaymode-action">
<span id="M:Sansar.Simulation.ScenePrivate.SetTimeOfDayMode(Sansar.Simulation.TimeOfDayMode,System.Action{Sansar.Script.OperationCompleteEvent})"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public void SetTimeOfDayMode(
    TimeOfDayMode mode,
    Action<Sansar.Script.OperationCompleteEvent> handler
)
```

Sets how the scene&#39;s time of day runs.

| Parameter | Type | Description |
|---|---|---|
| `mode` | [TimeOfDayMode](/scripting/api/sansar.simulation/timeofdaymode) | The new mode. |
| `handler` | [Action&lt;Sansar.Script.OperationCompleteEvent&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

<details class="api-remarks"><summary>Remarks</summary>

Every user in the scene sees the change. The clock carries on from its current reading: switching from [`TimeOfDayMode.Cycle`](/scripting/api/sansar.simulation/timeofdaymode#F:Sansar.Simulation.TimeOfDayMode.Cycle) to [`TimeOfDayMode.Fixed`](/scripting/api/sansar.simulation/timeofdaymode#F:Sansar.Simulation.TimeOfDayMode.Fixed) holds the sun where it is, and switching back sets it moving again from there. A scene built with the mode [`TimeOfDayMode.Off`](/scripting/api/sansar.simulation/timeofdaymode#F:Sansar.Simulation.TimeOfDayMode.Off) has its sun baked into the lighting, so the bounced sunlight stays as built when a script turns the time of day on; build the scene with the mode [`TimeOfDayMode.Fixed`](/scripting/api/sansar.simulation/timeofdaymode#F:Sansar.Simulation.TimeOfDayMode.Fixed) or [`TimeOfDayMode.Cycle`](/scripting/api/sansar.simulation/timeofdaymode#F:Sansar.Simulation.TimeOfDayMode.Cycle) for the full effect.

</details>

<details class="api-example" open><summary>Example</summary>

```csharp
ScenePrivate.SetTimeOfDayMode(TimeOfDayMode.Cycle); // Start the day and night cycle
```

</details>

</div>

### ShakeCameraAtPosition

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.ShakeCameraAtPosition(Sansar.Vector,System.Single,Sansar.Simulation.CameraShakeSettings)"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public CameraShakeHandle ShakeCameraAtPosition(
    Sansar.Vector position,
    float radius,
    CameraShakeSettings settings
)
```

Requests a shake for current players, attenuated by camera distance from a world position.

| Parameter | Type | Description |
|---|---|---|
| `position` | [Sansar.Vector](/scripting/api/sansar/vector) | Stationary world-space source position in meters; W is ignored. |
| `radius` | [float](https://learn.microsoft.com/dotnet/api/system.single) | World-space radius in meters, clamped to 0 through 1000; 0 is inert. |
| `settings` | [CameraShakeSettings](/scripting/api/sansar.simulation/camerashakesettings) | Settings to snapshot, or null for fresh default settings. |

**Returns:** [CameraShakeHandle](/scripting/api/sansar.simulation/camerashakehandle) — A non-null handle for this script&#39;s request, including inert requests.

<details class="api-remarks"><summary>Remarks</summary>

Strength falls to zero at the radius using each player&#39;s unshaken viewing camera. Only players present at the call receive it. Direction remains in camera space. Player comfort settings and VR limits can reduce or suppress any shake. Leaving the world ends that player&#39;s shake. Only the rendered view changes; camera transforms, audio and targeting are unaffected.

```csharp title="CameraShakeExample.cs"
/* This example is licensed under the Creative Commons Attribution 4.0 International License.
 * Copyright 2026 Sansar, Inc. https://creativecommons.org/licenses/by/4.0/
 */

using System;
using System.Collections.Generic;
using Sansar;
using Sansar.Script;
using Sansar.Simulation;

/// <summary>Demonstrates camera shake with chat commands on the default channel.</summary>
/// <remarks>Use /shake rumble, jitter, sway, impact, near, engine or stop.
/// Engine toggles a continuous rumble for the sender; stop clears this script's shakes for everyone.
/// An optional CameraComponent on this object fixes the view for current and future users.
/// Player comfort settings and VR limits can reduce or suppress the motion.</remarks>
public class CameraShakeExample : SceneObjectScript
{
    private CameraComponent camera;
    private readonly Dictionary<SessionId, CameraShakeHandle> engines =
        new Dictionary<SessionId, CameraShakeHandle>();

    /// <summary>Sets up chat commands and the optional fixed camera.</summary>
    public override void Init()
    {
        ObjectPrivate.TryGetFirstComponent(out camera);
        ScenePrivate.User.Subscribe(User.AddUser, OnUserAdded);
        ScenePrivate.User.Subscribe(User.RemoveUser, OnUserRemoved);
        ScenePrivate.Chat.Subscribe(Chat.DefaultChannel, OnChat, true);

        // Script reloads also need to set up users who are already in the world.
        foreach (AgentPrivate agent in ScenePrivate.GetAgents())
        {
            SetCamera(agent);
        }

        // The Debug local-source live test requires this marker from the real body.
        Log.Write("CameraShakeExample ready (real shake body): /shake rumble, jitter, sway, impact, near, engine, stop");
    }

    private void SetCamera(AgentPrivate agent)
    {
        if (camera != null && agent != null && agent.IsValid)
        {
            agent.Client.SetActiveCamera(camera, ScriptCameraControlMode.AgentControlOnly);
        }
    }

    private void OnUserAdded(UserData data)
    {
        SetCamera(ScenePrivate.FindAgent(data.User));
    }

    private void OnUserRemoved(UserData data)
    {
        // Leaving the world ends that player's shake; discard the old session's handle.
        engines.Remove(data.User);
    }

    private bool StopEngine(SessionId sessionId)
    {
        CameraShakeHandle engine;
        if (!engines.TryGetValue(sessionId, out engine))
        {
            return false;
        }

        engine.Stop(0.25f);
        engines.Remove(sessionId);
        return true;
    }

    private void OnChat(ChatData data)
    {
        string[] words = data.Message.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        if (words.Length != 2 || !words[0].Equals("/shake", StringComparison.OrdinalIgnoreCase))
        {
            return;
        }

        // SourceId identifies the sender, rather than the object running this script.
        AgentPrivate agent = ScenePrivate.FindAgent(data.SourceId);
        if (agent == null || !agent.IsValid)
        {
            return;
        }
        SessionId sessionId = agent.AgentInfo.SessionId;

        switch (words[1].ToLowerInvariant())
        {
            case "rumble":
                // Presets are mutable: edit before starting. Starts snapshot the settings.
                CameraShakeSettings rumble = CameraShakeSettings.Earthquake();
                rumble.Direction = new Vector(1, 0.5f, 0);
                agent.Client.ShakeCamera(rumble);
                break;

            case "jitter":
                agent.Client.ShakeCamera(new CameraShakeSettings
                {
                    Pattern = CameraShakePattern.Jitter,
                    Magnitude = 0.25f,
                    Duration = 1.0f
                    // Frequency 0 uses Jitter's default of 20 Hz.
                });
                break;

            case "sway":
                // Long side-to-side motion for the fixed-camera pixel-displacement test.
                agent.Client.ShakeCamera(new CameraShakeSettings
                {
                    Pattern = CameraShakePattern.Sway,
                    Magnitude = 0.6f,
                    Frequency = 2.0f,
                    Duration = 6.0f,
                    Direction = new Vector(1, 0, 0),
                    FadeOut = 0.3f
                });
                break;

            case "impact":
                // Landing: one downward kick. Duration 0 would still give just one kick.
                agent.Client.ShakeCamera(CameraShakeSettings.Impact(new Vector(0, -1, 0)));
                break;

            case "near":
                // Only players present now receive this explosion. Their camera distance
                // from this object's world position controls falloff to zero at 20 meters.
                ScenePrivate.ShakeCameraAtPosition(ObjectPrivate.Position, 20.0f,
                    CameraShakeSettings.Explosion());
                break;

            case "engine":
                // Send again to stop; separate sessions retain separate handles.
                if (!StopEngine(sessionId))
                {
                    engines[sessionId] = agent.Client.ShakeCamera(CameraShakeSettings.EngineRumble());
                }
                break;

            case "stop":
                StopEngine(sessionId);
                // Both stop-all scopes affect only shakes requested by this script.
                agent.Client.StopAllCameraShakes();
                ScenePrivate.StopAllCameraShakes();
                engines.Clear();
                break;
        }
    }
}
```

<p class="api-example-source">Source: <code>Examples/CameraShakeExample.cs</code> in the Sansar 47.10.0 client ScriptApi snapshot.</p>

</details>

</div>

### StopAllCameraShakes

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.StopAllCameraShakes(System.Single)"></span>
<div class="api-badges"><span class="api-badge api-new">New in 47.10.0</span></div>

```csharp signature
public void StopAllCameraShakes(float fadeOut)
```

Stops all shakes from the calling script on current players in this scene.

| Parameter | Type | Description |
|---|---|---|
| `fadeOut` | [float](https://learn.microsoft.com/dotnet/api/system.single) | Ending fade in seconds, clamped to 0 through 5; defaults to 0.1. |

<details class="api-remarks"><summary>Remarks</summary>

0 stops immediately. Shakes from other scripts are unaffected.

</details>

</div>

### ToString

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.ToString"></span>
<span id="M:Sansar.Simulation.ScenePrivate.ToString()"></span>

```csharp signature
public override string ToString()
```

A string representation of this object.

**Returns:** [string](https://learn.microsoft.com/dotnet/api/system.string) — A string representation of this object.

<details class="api-remarks"><summary>Remarks</summary>

The format of this string may change between releases.

</details>

</div>

### VoiceBroadcastStart

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.VoiceBroadcastStart(Sansar.Simulation.AgentPrivate)"></span>
<div class="api-badges"><span class="api-badge api-deprecated">Deprecated</span></div>

```csharp signature
[System.Obsolete("Deprecated. use ScenePrivate.SetMegaphone(agent, true) instead", false)]
public void VoiceBroadcastStart(AgentPrivate agent)
```

Start broadcasting agent&#39;s voice to the voice broadcast channel.

| Parameter | Type | Description |
|---|---|---|
| `agent` | [AgentPrivate](/scripting/api/sansar.simulation/agentprivate) | Agent to broadcast. |

<details class="api-remarks"><summary>Remarks</summary>

Plays for all agents in this scene.

</details>

</div>

### VoiceBroadcastStop

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.VoiceBroadcastStop(Sansar.Simulation.AgentPrivate)"></span>
<div class="api-badges"><span class="api-badge api-deprecated">Deprecated</span></div>

```csharp signature
[System.Obsolete("Deprecated. use ScenePrivate.SetMegaphone(agent, false) instead", false)]
public void VoiceBroadcastStop(AgentPrivate agent)
```

Stop broadcasting agent&#39;s voice to voice broadcast channel.

| Parameter | Type | Description |
|---|---|---|
| `agent` | [AgentPrivate](/scripting/api/sansar.simulation/agentprivate) | Agent to stop broadcasting. |

<details class="api-remarks"><summary>Remarks</summary>

Stops for all agents in this scene.

</details>

</div>

### VoiceBroadcastStopAll

<div class="api-card">
<span id="M:Sansar.Simulation.ScenePrivate.VoiceBroadcastStopAll"></span>
<span id="M:Sansar.Simulation.ScenePrivate.VoiceBroadcastStopAll()"></span>
<div class="api-badges"><span class="api-badge api-deprecated">Deprecated</span></div>

```csharp signature
[System.Obsolete("Deprecated. use AgentPrivate.SetMegaphone(false) instead", false)]
public void VoiceBroadcastStopAll()
```

Stop broadcasting all voices to voice broadcast channel.

<details class="api-remarks"><summary>Remarks</summary>

Stops for all agents in this scene.

</details>

</div>


## Used in examples

- [FollowThePath.cs](/scripting/examples/follow-the-path)
- [MoverExample1.cs](/scripting/examples/mover-examples)
- [MoverExample3.cs](/scripting/examples/mover-examples)
- [ReflectiveDetectorExample.cs](/scripting/examples/reflective-detector)
- [StatsExample.cs](/scripting/examples/stats-example)
- [TeleportHotkeys.cs](/scripting/examples/teleport-hotkeys)
- [VisitorTrackerExample.cs](/scripting/examples/visitor-tracker)
- [AgentGravityExample.cs](https://github.com/Wookey-Technologies/sansar-script-starter/blob/66af8b516b701088d043e4615acfcf5779356604/examples/official/AgentGravityExample.cs)
- [AgentScaleExample.cs](https://github.com/Wookey-Technologies/sansar-script-starter/blob/66af8b516b701088d043e4615acfcf5779356604/examples/official/AgentScaleExample.cs)
- [BanHammerExample.cs](https://github.com/Wookey-Technologies/sansar-script-starter/blob/66af8b516b701088d043e4615acfcf5779356604/examples/official/BanHammerExample.cs)
- [BroadcastUsers.cs](https://github.com/Wookey-Technologies/sansar-script-starter/blob/66af8b516b701088d043e4615acfcf5779356604/examples/official/BroadcastUsers.cs)
- `CameraShakeExample.cs`

…and 56 more examples in the snapshot.

<p class="api-generated" data-pagefind-ignore>Generated from the Sansar 47.10.0 client ScriptApi snapshot.</p>