The AgentPrivate class is the full interface for interactions with avatars.
public class AgentPrivate : Sansar.Script.InstanceInterfaceRemarks
Use via AgentScript.AgentPrivate to access APIs for the agent the script is on.
Members at a glance
| Kind | Members |
|---|---|
| Properties | AgentInfo · Client |
| Methods | AddReaction · ApplyRagdollImpulse · ApplyRagdollImpulseToRegions · ClearAllowFlightOverride New in 47.10.0 · ClearColorLutOverride New in 47.10.0 · GetAllowFlight New in 47.10.0 · GetControlPointEnabled · GetControlPointOrientation · GetControlPointPosition · GetGravityFactor · GetHeldRigidBodies · GetRagdollBounce · GetRagdollEnabled · GetScaleFactor · GetSpeedFactor · IgnoreCollisionWith · IsCollisionIgnoredWith · OverrideAudioStream · OverrideIndexedMediaSource · OverrideMediaSource · PerformIndexedMediaAction · PerformMediaAction · PlaySound · PlaySoundAtPosition · PlaySoundOnComponent · PlayStream · PlayStreamAtPosition · PlayStreamOnComponent · RemoveReaction · SendChat · SetAllowFlight New in 47.10.0 · SetColorLut New in 47.10.0 · SetGravityFactor · SetRagdollBounce · SetRagdollEnabled · SetScaleFactor · SetScaleFactorAnimated · SetSpeedFactor · ToString |
Properties
AgentInfo
public AgentInfo AgentInfo { get; }Returns the AgentInfo for this instance.
Value: AgentInfo — The AgentInfo for this instance
Remarks
The AgentInfo holds information about an agent.
Client
public Client Client { get; }Returns the Client for this instance.
Value: Client — The Client for this instance
Remarks
The Client manages interactions with a client.
Methods
AddReaction
public void AddReaction(
string reactionType,
string displayText,
ThumbnailedClusterResource resource
)Add a new reaction type to this agent only
| Parameter | Type | Description |
|---|---|---|
reactionType | string | A string that gets passed to the callback. Should be of a form like ‘Developer.Type’ to match the default, e.g. ‘Sansar.Fire’ |
displayText | string | A short string that appears on the emotes panel |
resource | ThumbnailedClusterResource | A cluster source which has a thumbnail defined in inventory. |
ApplyRagdollImpulse
public void ApplyRagdollImpulse(Sansar.Vector impulse)Applies a linear impulse to the entire ragdoll.
| Parameter | Type | Description |
|---|---|---|
impulse | Sansar.Vector | The impulse vector in world space. |
Remarks
This automatically enables ragdoll if needed and uses the default auto-recovery delay of 2 seconds. This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.
public void ApplyRagdollImpulse(
Sansar.Vector impulse,
Action<Sansar.Script.OperationCompleteEvent> handler
)Applies a linear impulse to the entire ragdoll.
| Parameter | Type | Description |
|---|---|---|
impulse | Sansar.Vector | The impulse vector in world space. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
This automatically enables ragdoll if needed and uses the default auto-recovery delay of 2 seconds. This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.
public void ApplyRagdollImpulse(
Sansar.Vector impulse,
float autoRecoverDelaySeconds
)Applies a linear impulse to the entire ragdoll and sets the auto-recovery delay.
| Parameter | Type | Description |
|---|---|---|
impulse | Sansar.Vector | The impulse vector in world space. |
autoRecoverDelaySeconds | float | Seconds before auto-recovery begins. Set to 0 to disable auto-recovery. |
Remarks
This automatically enables ragdoll if needed. This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.
public void ApplyRagdollImpulse(
Sansar.Vector impulse,
float autoRecoverDelaySeconds,
Action<Sansar.Script.OperationCompleteEvent> handler
)Applies a linear impulse to the entire ragdoll and sets the auto-recovery delay.
| Parameter | Type | Description |
|---|---|---|
impulse | Sansar.Vector | The impulse vector in world space. |
autoRecoverDelaySeconds | float | Seconds before auto-recovery begins. Set to 0 to disable auto-recovery. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
This automatically enables ragdoll if needed. This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.
ApplyRagdollImpulseToRegions
public void ApplyRagdollImpulseToRegions(
Sansar.Vector impulse,
RagdollRegion regions
)Applies a linear impulse to specific ragdoll body regions.
| Parameter | Type | Description |
|---|---|---|
impulse | Sansar.Vector | The impulse vector in world space. |
regions | RagdollRegion | One or more RagdollRegion flags combined with bitwise OR (e.g. RagdollRegion.LeftArm | RagdollRegion.LeftLeg). |
Remarks
Applying impulse to one side (e.g. LeftArm | LeftLeg) creates a spinning fall effect. This automatically enables ragdoll if needed and uses the default auto-recovery delay of 2 seconds. This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.
public void ApplyRagdollImpulseToRegions(
Sansar.Vector impulse,
RagdollRegion regions,
Action<Sansar.Script.OperationCompleteEvent> handler
)Applies a linear impulse to specific ragdoll body regions.
| Parameter | Type | Description |
|---|---|---|
impulse | Sansar.Vector | The impulse vector in world space. |
regions | RagdollRegion | One or more RagdollRegion flags combined with bitwise OR (e.g. RagdollRegion.LeftArm | RagdollRegion.LeftLeg). |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
Applying impulse to one side (e.g. LeftArm | LeftLeg) creates a spinning fall effect. This automatically enables ragdoll if needed and uses the default auto-recovery delay of 2 seconds. This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.
public void ApplyRagdollImpulseToRegions(
Sansar.Vector impulse,
RagdollRegion regions,
float autoRecoverDelaySeconds
)Applies a linear impulse to specific ragdoll body regions and sets the auto-recovery delay.
| Parameter | Type | Description |
|---|---|---|
impulse | Sansar.Vector | The impulse vector in world space. |
regions | RagdollRegion | One or more RagdollRegion flags combined with bitwise OR (e.g. RagdollRegion.LeftArm | RagdollRegion.LeftLeg). |
autoRecoverDelaySeconds | float | Seconds before auto-recovery begins. Set to 0 to disable auto-recovery. |
Remarks
Applying impulse to one side (e.g. LeftArm | LeftLeg) creates a spinning fall effect. This automatically enables ragdoll if needed. This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.
public void ApplyRagdollImpulseToRegions(
Sansar.Vector impulse,
RagdollRegion regions,
float autoRecoverDelaySeconds,
Action<Sansar.Script.OperationCompleteEvent> handler
)Applies a linear impulse to specific ragdoll body regions and sets the auto-recovery delay.
| Parameter | Type | Description |
|---|---|---|
impulse | Sansar.Vector | The impulse vector in world space. |
regions | RagdollRegion | One or more RagdollRegion flags combined with bitwise OR (e.g. RagdollRegion.LeftArm | RagdollRegion.LeftLeg). |
autoRecoverDelaySeconds | float | Seconds before auto-recovery begins. Set to 0 to disable auto-recovery. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
Applying impulse to one side (e.g. LeftArm | LeftLeg) creates a spinning fall effect. This automatically enables ragdoll if needed. This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.
ClearAllowFlightOverride
public void ClearAllowFlightOverride()Clears this agent’s per-agent flight override.
Remarks
The agent will inherit this instance’s default. The write is queued for the next world update. The callback, or 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.
public void ClearAllowFlightOverride(
Action<Sansar.Script.OperationCompleteEvent> handler
)Clears this agent’s per-agent flight override.
| Parameter | Type | Description |
|---|---|---|
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
The agent will inherit this instance’s default. The write is queued for the next world update. The callback, or 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.
ClearColorLutOverride
public void ClearColorLutOverride()Clears this agent’s color LUT override.
Remarks
The agent goes back to the scene-wide LUT, see ScenePrivate.SetColorLut. The write is queued for the next world update. The callback, or 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.
public void ClearColorLutOverride(
Action<Sansar.Script.OperationCompleteEvent> handler
)Clears this agent’s color LUT override.
| Parameter | Type | Description |
|---|---|---|
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
The agent goes back to the scene-wide LUT, see ScenePrivate.SetColorLut. The write is queued for the next world update. The callback, or 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.
GetAllowFlight
public bool GetAllowFlight()Gets whether flying is available for this agent.
Returns: bool — The agent’s override, or the instance default if no override is set.
Remarks
This is the committed effective permission; control mode and interaction rules still apply.
GetControlPointEnabled
public bool GetControlPointEnabled(ControlPointType type)Retrieves whether the control point is enabled.
| Parameter | Type | Description |
|---|---|---|
type | ControlPointType | See ControlPointType. |
Returns: bool — True if the control point is enabled. Control points are enabled when used.
Remarks
Control points are a representation of some spatial inputs, primarily VR controllers.
GetControlPointOrientation
public Sansar.Quaternion GetControlPointOrientation(
ControlPointType type
)Retrieves the orientation in character relative space of the specified control point.
| Parameter | Type | Description |
|---|---|---|
type | ControlPointType | See ControlPointType. |
Returns: Sansar.Quaternion — The orientation of the control point.
Remarks
Control points are a representation of some spatial inputs, primarily VR controllers.
GetControlPointPosition
public Sansar.Vector GetControlPointPosition(ControlPointType type)Retrieves the position in character relative space of the specified control point.
| Parameter | Type | Description |
|---|---|---|
type | ControlPointType | The control point to get the position of. See ControlPointType. |
Returns: Sansar.Vector — The position of the control point.
Remarks
Control points are a representation of some spatial inputs, primarily VR controllers.
GetGravityFactor
public float GetGravityFactor()Retrieves what factor of the world’s gravity is applied to this agent.
Returns: float — The gravity factor.
GetHeldRigidBodies
public IEnumerable<RigidBodyComponent> GetHeldRigidBodies()Retrieves a list of RigidBodyComponent that this agent is currently holding.
Returns: IEnumerable<RigidBodyComponent> — a list of RigidBodyComponent
GetRagdollBounce
public float GetRagdollBounce()Gets the current ragdoll bounce factor.
Returns: float — The bounce factor (0-1).
GetRagdollEnabled
public bool GetRagdollEnabled()Returns whether ragdoll physics is currently active for this agent.
Returns: bool — True if ragdoll is active.
GetScaleFactor
public float GetScaleFactor()Retrieves the runtime scale factor applied to this agent.
Returns: float — The scale factor.
GetSpeedFactor
public float GetSpeedFactor()Retrieves what factor of the base speed to apply to this agent.
Returns: float — The speed factor.
IgnoreCollisionWith
public void IgnoreCollisionWith(
RigidBodyComponent rigidBodyComponent,
bool ignoreBody
)Sets whether this agent will ignore collisions with a specific RigidBodyComponent
| Parameter | Type | Description |
|---|---|---|
rigidBodyComponent | RigidBodyComponent | The RigidBodyComponent with which to change collision behavior. |
ignoreBody | bool | When true, collision will be added to the ignore list. When false, collision will removed from the ignore list. |
Remarks
This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.
public void IgnoreCollisionWith(
RigidBodyComponent rigidBodyComponent,
bool ignoreBody,
Action<Sansar.Script.OperationCompleteEvent> handler
)Sets whether this agent will ignore collisions with a specific RigidBodyComponent
| Parameter | Type | Description |
|---|---|---|
rigidBodyComponent | RigidBodyComponent | The RigidBodyComponent with which to change collision behavior. |
ignoreBody | bool | When true, collision will be added to the ignore list. When false, collision will removed from the ignore list. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.
IsCollisionIgnoredWith
public bool IsCollisionIgnoredWith(
RigidBodyComponent rigidBodyComponent
)Checks whether an agent is ignoring collisions with a specific RigidBodyComponent.
| Parameter | Type | Description |
|---|---|---|
rigidBodyComponent | RigidBodyComponent | The RigidBodyComponent that could possibly be ignored. |
Returns: bool
OverrideAudioStream
public void OverrideAudioStream(string url)Overrides source of web audio streams.
| Parameter | Type | Description |
|---|---|---|
url | string | URL to use. |
Remarks
Applies to this agent only. 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.
public void OverrideAudioStream(
string url,
Action<Sansar.Script.OperationCompleteEvent> handler
)Overrides source of web audio streams.
| Parameter | Type | Description |
|---|---|---|
url | string | URL to use. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
Applies to this agent only. 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.
OverrideIndexedMediaSource
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 | URL to use. |
mediaIndex | int | (cMediaChannel only) source index. |
mediaWidth | int | (cMediaChannel only) source width. |
mediaHeight | int | (cMediaChannel only) source height. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
Applies to this agent only. 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.
OverrideMediaSource
public void OverrideMediaSource(string url)Sets stream channel source.
| Parameter | Type | Description |
|---|---|---|
url | string | URL to use. |
public void OverrideMediaSource(
string url,
int mediaWidth,
int mediaHeight
)Overrides source of media surfaces.
| Parameter | Type | Description |
|---|---|---|
url | string | URL to use. |
mediaWidth | int | (cMediaChannel only) source width. |
mediaHeight | int | (cMediaChannel only) source height. |
Remarks
Applies to this agent only. 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.
public void OverrideMediaSource(
string url,
int mediaWidth,
int mediaHeight,
Action<Sansar.Script.OperationCompleteEvent> handler
)Overrides source of media surfaces.
| Parameter | Type | Description |
|---|---|---|
url | string | URL to use. |
mediaWidth | int | (cMediaChannel only) source width. |
mediaHeight | int | (cMediaChannel only) source height. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
Applies to this agent only. 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.
PerformIndexedMediaAction
public void PerformIndexedMediaAction(
MediaAction action,
int mediaIndex,
Action<Sansar.Script.OperationCompleteEvent> handler
)Performs a specific action on the current media surface.
| Parameter | Type | Description |
|---|---|---|
action | MediaAction | The action to perform. |
mediaIndex | int | (cMediaChannel only) source index. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
Applies to this agent only.
PerformMediaAction
public void PerformMediaAction(MediaAction action)Performs a specific action on the current media surface.
| Parameter | Type | Description |
|---|---|---|
action | MediaAction | The action to perform. |
Remarks
Applies to this agent only.
public void PerformMediaAction(
MediaAction action,
Action<Sansar.Script.OperationCompleteEvent> handler
)Performs a specific action on the current media surface index.
| Parameter | Type | Description |
|---|---|---|
action | MediaAction | The action to perform. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
Applies to this agent only.
PlaySound
public PlayHandle PlaySound(
SoundResource soundResource,
PlaySettings playSettings
)Play sound to direct output.
| Parameter | Type | Description |
|---|---|---|
soundResource | SoundResource | The sound resource to play. |
playSettings | PlaySettings | The play parameters. |
Returns: PlayHandle — The play handle for controlling playback.
Remarks
Plays for this agent only.
PlaySoundAtPosition
public PlayHandle PlaySoundAtPosition(
SoundResource soundResource,
Sansar.Vector position,
PlaySettings playSettings
)Play sound at specified position.
| Parameter | Type | Description |
|---|---|---|
soundResource | SoundResource | The sound resource to play. |
position | Sansar.Vector | The absolute position. |
playSettings | PlaySettings | The play parameters. |
Returns: PlayHandle — The play handle for controlling playback.
Remarks
Plays for this agent only. 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.
PlaySoundOnComponent
public PlayHandle PlaySoundOnComponent(
SoundResource soundResource,
AudioComponent audioComponent,
PlaySettings playSettings
)Play sound on a component (and follows its position).
| Parameter | Type | Description |
|---|---|---|
soundResource | SoundResource | The sound resource to play. |
audioComponent | AudioComponent | The audio component to play this on. |
playSettings | PlaySettings | The play parameters. |
Returns: PlayHandle — The play handle for controlling playback.
Remarks
Plays for this agent only. As the component moves, this sound will follow the component’s location.
PlayStream
public PlayHandle PlayStream(
StreamChannel streamChannel,
float loudness
)Play audio stream to direct output.
| Parameter | Type | Description |
|---|---|---|
streamChannel | StreamChannel | Channel of the audio stream to play. |
loudness | float | Relative loudness in dB. |
Returns: PlayHandle — The play handle for controlling playback.
Remarks
Plays for this agent only.
PlayStreamAtPosition
public PlayHandle PlayStreamAtPosition(
StreamChannel streamChannel,
Sansar.Vector position,
float loudness
)Play web audio stream at specified position.
| Parameter | Type | Description |
|---|---|---|
streamChannel | StreamChannel | Channel of the audio stream to play. |
position | Sansar.Vector | The absolute position. |
loudness | float | Relative loudness in dB. |
Returns: PlayHandle — The play handle for controlling playback.
Remarks
Plays for this agent only. 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.
PlayStreamOnComponent
public PlayHandle PlayStreamOnComponent(
StreamChannel streamChannel,
AudioComponent audioComponent,
float loudness
)Play web audio stream on this component (and follow its position).
| Parameter | Type | Description |
|---|---|---|
streamChannel | StreamChannel | Channel of the audio stream to play. |
audioComponent | AudioComponent | The audio component to play this on. |
loudness | float | Relative loudness in dB. |
Returns: PlayHandle — The play handle for controlling playback.
Remarks
Plays for this agent only. As the component moves, this sound will follow the component’s location.
RemoveReaction
public void RemoveReaction(string reactionType)Remove the specified reaction from this agent.
| Parameter | Type | Description |
|---|---|---|
reactionType | string | A string that gets passed to the callback. Should be of a form like ‘Developer.Type’ to match the default, e.g. ‘Sansar.Fire’ |
SendChat
public void SendChat(string message)Sends a String message to the $className$.
| Parameter | Type | Description |
|---|---|---|
message | string | The message to send. |
Throws NullReferenceException: If the user is no longer online.
Throws ThrottleException: If the throttle rate is exceeded.
Remarks
eprecated. Use AgentPrivate.SendChat or AgentPublic.SendChat
public void SendChat(
string message,
Action<Sansar.Script.OperationCompleteEvent> handler
)Sends a String message to the AgentPrivate.
| Parameter | Type | Description |
|---|---|---|
message | string | The message to send. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
Messages may be throttled and ignored.
SetAllowFlight
public void SetAllowFlight(bool allowFlight)Sets whether flying is available for this agent.
| Parameter | Type | Description |
|---|---|---|
allowFlight | bool | True to allow this agent to fly, false to prevent it. |
Remarks
The explicit override persists until cleared or the agent leaves, even when the instance default changes. It is per instance, not saved to the world or shared with clone regions. The write is queued for the next world update. The callback, or 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.
public void SetAllowFlight(
bool allowFlight,
Action<Sansar.Script.OperationCompleteEvent> handler
)Sets whether flying is available for this agent.
| Parameter | Type | Description |
|---|---|---|
allowFlight | bool | True to allow this agent to fly, false to prevent it. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
The explicit override persists until cleared or the agent leaves, even when the instance default changes. It is per instance, not saved to the world or shared with clone regions. The write is queued for the next world update. The callback, or 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.
SetColorLut
public void SetColorLut(TextureResource lut)Overrides the color LUT for this agent alone.
| Parameter | Type | Description |
|---|---|---|
lut | TextureResource | The LUT texture to grade this agent’s view with, or null to clear the override. |
Remarks
Takes precedence over the LUT chosen in the scene settings and over ScenePrivate.SetColorLut. A PostFX volume with its own LUT still takes over while this agent’s camera is inside it. The override persists until cleared or the agent leaves. It is per instance, not saved to the world or shared with clone regions. The write is queued for the next world update. The callback, or 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.
public void SetColorLut(
TextureResource lut,
Action<Sansar.Script.OperationCompleteEvent> handler
)Overrides the color LUT for this agent alone.
| Parameter | Type | Description |
|---|---|---|
lut | TextureResource | The LUT texture to grade this agent’s view with, or null to clear the override. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
Takes precedence over the LUT chosen in the scene settings and over ScenePrivate.SetColorLut. A PostFX volume with its own LUT still takes over while this agent’s camera is inside it. The override persists until cleared or the agent leaves. It is per instance, not saved to the world or shared with clone regions. The write is queued for the next world update. The callback, or 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.
SetGravityFactor
public void SetGravityFactor(float gravityFactor)Sets what factor of the world’s gravity is applied to this agent.
| Parameter | Type | Description |
|---|---|---|
gravityFactor | float | The gravityFactor. Default value is 1, range is clamped between -2 to 2 |
Remarks
This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.
public void SetGravityFactor(
float gravityFactor,
Action<Sansar.Script.OperationCompleteEvent> handler
)Sets what factor of the world’s gravity is applied to this agent.
| Parameter | Type | Description |
|---|---|---|
gravityFactor | float | The gravityFactor. Default value is 1, range is clamped between -2 to 2 |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.
SetRagdollBounce
public void SetRagdollBounce(float bounce)Sets the bounciness of the ragdoll body.
| Parameter | Type | Description |
|---|---|---|
bounce | float | Bounce factor from 0 (no bounce) to 1 (maximum bounce). Default is 0. |
Remarks
This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.
public void SetRagdollBounce(
float bounce,
Action<Sansar.Script.OperationCompleteEvent> handler
)Sets the bounciness of the ragdoll body.
| Parameter | Type | Description |
|---|---|---|
bounce | float | Bounce factor from 0 (no bounce) to 1 (maximum bounce). Default is 0. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.
SetRagdollEnabled
public void SetRagdollEnabled(bool enabled)Enables or disables ragdoll physics on this agent.
| Parameter | Type | Description |
|---|---|---|
enabled | bool | True to enable ragdoll, false to disable. |
Remarks
Enabling ragdoll through this overload uses the default auto-recovery delay of 2 seconds. This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.
public void SetRagdollEnabled(
bool enabled,
Action<Sansar.Script.OperationCompleteEvent> handler
)Enables or disables ragdoll physics on this agent.
| Parameter | Type | Description |
|---|---|---|
enabled | bool | True to enable ragdoll, false to disable. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
Enabling ragdoll through this overload uses the default auto-recovery delay of 2 seconds. This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.
public void SetRagdollEnabled(
bool enabled,
float autoRecoverDelaySeconds
)Enables or disables ragdoll physics on this agent and sets the auto-recovery delay.
| Parameter | Type | Description |
|---|---|---|
enabled | bool | True to enable ragdoll, false to disable. |
autoRecoverDelaySeconds | float | Seconds before auto-recovery begins. Set to 0 to disable auto-recovery. |
Remarks
This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.
public void SetRagdollEnabled(
bool enabled,
float autoRecoverDelaySeconds,
Action<Sansar.Script.OperationCompleteEvent> handler
)Enables or disables ragdoll physics on this agent and sets the auto-recovery delay.
| Parameter | Type | Description |
|---|---|---|
enabled | bool | True to enable ragdoll, false to disable. |
autoRecoverDelaySeconds | float | Seconds before auto-recovery begins. Set to 0 to disable auto-recovery. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.
SetScaleFactor
public void SetScaleFactor(float scaleFactor)Sets a runtime scale factor for this agent.
| Parameter | Type | Description |
|---|---|---|
scaleFactor | float | The scaleFactor. Default value is 1, range is clamped between 0.01 to 100 |
Remarks
This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.
public void SetScaleFactor(
float scaleFactor,
Action<Sansar.Script.OperationCompleteEvent> handler
)Sets a runtime scale factor for this agent.
| Parameter | Type | Description |
|---|---|---|
scaleFactor | float | The scaleFactor. Default value is 1, range is clamped between 0.01 to 100 |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.
SetScaleFactorAnimated
public void SetScaleFactorAnimated(float scaleFactor, float seconds)Sets a runtime scale factor for this agent, interpolating smoothly over the given duration.
| Parameter | Type | Description |
|---|---|---|
scaleFactor | float | The target scaleFactor. Range is clamped between 0.01 to 100 |
seconds | float | The duration in seconds over which to interpolate. If 0 or negative, the change is instant. |
Remarks
This asynchronous method queues the write then returns. The scale will smoothly transition from the current value to the target over the specified duration using a smooth ease curve. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.
public void SetScaleFactorAnimated(
float scaleFactor,
float seconds,
Action<Sansar.Script.OperationCompleteEvent> handler
)Sets a runtime scale factor for this agent, interpolating smoothly over the given duration.
| Parameter | Type | Description |
|---|---|---|
scaleFactor | float | The target scaleFactor. Range is clamped between 0.01 to 100 |
seconds | float | The duration in seconds over which to interpolate. If 0 or negative, the change is instant. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
This asynchronous method queues the write then returns. The scale will smoothly transition from the current value to the target over the specified duration using a smooth ease curve. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.
SetSpeedFactor
public void SetSpeedFactor(float speedFactor)Sets what factor of the base speed to apply to this agent.
| Parameter | Type | Description |
|---|---|---|
speedFactor | float | The speedFactor. Default value is 1, range is clamped between 0.1 to 4 |
Remarks
This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.
public void SetSpeedFactor(
float speedFactor,
Action<Sansar.Script.OperationCompleteEvent> handler
)Sets what factor of the base speed to apply to this agent.
| Parameter | Type | Description |
|---|---|---|
speedFactor | float | The speedFactor. Default value is 1, range is clamped between 0.1 to 4 |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.
ToString
public override string ToString()A string representation of this object.
Returns: string — A string representation of this object.
Remarks
The format of this string may change between releases.
Used in examples
- MoverExample1.cs
- ReflectiveDetectorExample.cs
- StatsExample.cs
- TeleportHotkeys.cs
- VisitorTrackerExample.cs
- AgentGravityExample.cs
- AgentScaleExample.cs
- BanHammerExample.cs
CameraShakeExample.cs- CastRayExample.cs
ColorLutExample.cs- CommandScreenshot.cs
…and 29 more examples in the snapshot.
Generated from the Sansar 47.10.0 client ScriptApi snapshot.