Skip to content

Get Sansar

Script API

AgentPrivate

Where: Client
More page actions

For the complete documentation index, see llms.txt. This page is also available as Markdown.

The AgentPrivate class is the full interface for interactions with avatars.

public class AgentPrivate : Sansar.Script.InstanceInterface

Remarks

Use via AgentScript.AgentPrivate to access APIs for the agent the script is on.

Members at a glance

KindMembers
PropertiesAgentInfo · Client
MethodsAddReaction · 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

Added in 43.2.1
public void AddReaction(     string reactionType,     string displayText,     ThumbnailedClusterResource resource )

Add a new reaction type to this agent only

ParameterTypeDescription
reactionTypestringA string that gets passed to the callback. Should be of a form like ‘Developer.Type’ to match the default, e.g. ‘Sansar.Fire’
displayTextstringA short string that appears on the emotes panel
resourceThumbnailedClusterResourceA cluster source which has a thumbnail defined in inventory.

ApplyRagdollImpulse

Added in 47.1.1
public void ApplyRagdollImpulse(Sansar.Vector impulse)

Applies a linear impulse to the entire ragdoll.

ParameterTypeDescription
impulseSansar.VectorThe 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.

Added in 47.1.1
public void ApplyRagdollImpulse(     Sansar.Vector impulse,     Action<Sansar.Script.OperationCompleteEvent> handler )

Applies a linear impulse to the entire ragdoll.

ParameterTypeDescription
impulseSansar.VectorThe impulse vector in world space.
handlerAction<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.

Added in 47.1.1
public void ApplyRagdollImpulse(     Sansar.Vector impulse,     float autoRecoverDelaySeconds )

Applies a linear impulse to the entire ragdoll and sets the auto-recovery delay.

ParameterTypeDescription
impulseSansar.VectorThe impulse vector in world space.
autoRecoverDelaySecondsfloatSeconds 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.

Added in 47.1.1
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.

ParameterTypeDescription
impulseSansar.VectorThe impulse vector in world space.
autoRecoverDelaySecondsfloatSeconds before auto-recovery begins. Set to 0 to disable auto-recovery.
handlerAction<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

Added in 47.1.1
public void ApplyRagdollImpulseToRegions(     Sansar.Vector impulse,     RagdollRegion regions )

Applies a linear impulse to specific ragdoll body regions.

ParameterTypeDescription
impulseSansar.VectorThe impulse vector in world space.
regionsRagdollRegionOne 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.

Added in 47.1.1
public void ApplyRagdollImpulseToRegions(     Sansar.Vector impulse,     RagdollRegion regions,     Action<Sansar.Script.OperationCompleteEvent> handler )

Applies a linear impulse to specific ragdoll body regions.

ParameterTypeDescription
impulseSansar.VectorThe impulse vector in world space.
regionsRagdollRegionOne or more RagdollRegion flags combined with bitwise OR (e.g. RagdollRegion.LeftArm | RagdollRegion.LeftLeg).
handlerAction<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.

Added in 47.1.1
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.

ParameterTypeDescription
impulseSansar.VectorThe impulse vector in world space.
regionsRagdollRegionOne or more RagdollRegion flags combined with bitwise OR (e.g. RagdollRegion.LeftArm | RagdollRegion.LeftLeg).
autoRecoverDelaySecondsfloatSeconds 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.

Added in 47.1.1
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.

ParameterTypeDescription
impulseSansar.VectorThe impulse vector in world space.
regionsRagdollRegionOne or more RagdollRegion flags combined with bitwise OR (e.g. RagdollRegion.LeftArm | RagdollRegion.LeftLeg).
autoRecoverDelaySecondsfloatSeconds before auto-recovery begins. Set to 0 to disable auto-recovery.
handlerAction<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

New in 47.10.0
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.

New in 47.10.0
public void ClearAllowFlightOverride(     Action<Sansar.Script.OperationCompleteEvent> handler )

Clears this agent’s per-agent flight override.

ParameterTypeDescription
handlerAction<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

New in 47.10.0
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.

New in 47.10.0
public void ClearColorLutOverride(     Action<Sansar.Script.OperationCompleteEvent> handler )

Clears this agent’s color LUT override.

ParameterTypeDescription
handlerAction<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

New in 47.10.0
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.

ParameterTypeDescription
typeControlPointTypeSee 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.

ParameterTypeDescription
typeControlPointTypeSee 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.

ParameterTypeDescription
typeControlPointTypeThe 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

Added in 34.2.0
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

Added in 47.1.1
public float GetRagdollBounce()

Gets the current ragdoll bounce factor.

Returns: float — The bounce factor (0-1).

GetRagdollEnabled

Added in 47.1.1
public bool GetRagdollEnabled()

Returns whether ragdoll physics is currently active for this agent.

Returns: bool — True if ragdoll is active.

GetScaleFactor

Added in 47.1.1
public float GetScaleFactor()

Retrieves the runtime scale factor applied to this agent.

Returns: float — The scale factor.

GetSpeedFactor

Added in 36.8.0
public float GetSpeedFactor()

Retrieves what factor of the base speed to apply to this agent.

Returns: float — The speed factor.

IgnoreCollisionWith

Added in 36.8.0
public void IgnoreCollisionWith(     RigidBodyComponent rigidBodyComponent,     bool ignoreBody )

Sets whether this agent will ignore collisions with a specific RigidBodyComponent

ParameterTypeDescription
rigidBodyComponentRigidBodyComponentThe RigidBodyComponent with which to change collision behavior.
ignoreBodyboolWhen 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.

Added in 36.8.0
public void IgnoreCollisionWith(     RigidBodyComponent rigidBodyComponent,     bool ignoreBody,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets whether this agent will ignore collisions with a specific RigidBodyComponent

ParameterTypeDescription
rigidBodyComponentRigidBodyComponentThe RigidBodyComponent with which to change collision behavior.
ignoreBodyboolWhen true, collision will be added to the ignore list. When false, collision will removed from the ignore list.
handlerAction<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

Added in 36.8.0
public bool IsCollisionIgnoredWith(     RigidBodyComponent rigidBodyComponent )

Checks whether an agent is ignoring collisions with a specific RigidBodyComponent.

ParameterTypeDescription
rigidBodyComponentRigidBodyComponentThe RigidBodyComponent that could possibly be ignored.

Returns: bool

OverrideAudioStream

public void OverrideAudioStream(string url)

Overrides source of web audio streams.

ParameterTypeDescription
urlstringURL 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.

ParameterTypeDescription
urlstringURL to use.
handlerAction<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

Added in 46.5.0
public void OverrideIndexedMediaSource(     string url,     int mediaIndex,     int mediaWidth,     int mediaHeight,     Action<Sansar.Script.OperationCompleteEvent> handler )

Overrides source of indexed media surfaces.

ParameterTypeDescription
urlstringURL to use.
mediaIndexint(cMediaChannel only) source index.
mediaWidthint(cMediaChannel only) source width.
mediaHeightint(cMediaChannel only) source height.
handlerAction<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.

ParameterTypeDescription
urlstringURL to use.
public void OverrideMediaSource(     string url,     int mediaWidth,     int mediaHeight )

Overrides source of media surfaces.

ParameterTypeDescription
urlstringURL to use.
mediaWidthint(cMediaChannel only) source width.
mediaHeightint(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.

ParameterTypeDescription
urlstringURL to use.
mediaWidthint(cMediaChannel only) source width.
mediaHeightint(cMediaChannel only) source height.
handlerAction<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

Added in 46.5.0
public void PerformIndexedMediaAction(     MediaAction action,     int mediaIndex,     Action<Sansar.Script.OperationCompleteEvent> handler )

Performs a specific action on the current media surface.

ParameterTypeDescription
actionMediaActionThe action to perform.
mediaIndexint(cMediaChannel only) source index.
handlerAction<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.

ParameterTypeDescription
actionMediaActionThe 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.

ParameterTypeDescription
actionMediaActionThe action to perform.
handlerAction<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.

ParameterTypeDescription
soundResourceSoundResourceThe sound resource to play.
playSettingsPlaySettingsThe 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.

ParameterTypeDescription
soundResourceSoundResourceThe sound resource to play.
positionSansar.VectorThe absolute position.
playSettingsPlaySettingsThe 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).

ParameterTypeDescription
soundResourceSoundResourceThe sound resource to play.
audioComponentAudioComponentThe audio component to play this on.
playSettingsPlaySettingsThe 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.

ParameterTypeDescription
streamChannelStreamChannelChannel of the audio stream to play.
loudnessfloatRelative 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.

ParameterTypeDescription
streamChannelStreamChannelChannel of the audio stream to play.
positionSansar.VectorThe absolute position.
loudnessfloatRelative 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).

ParameterTypeDescription
streamChannelStreamChannelChannel of the audio stream to play.
audioComponentAudioComponentThe audio component to play this on.
loudnessfloatRelative 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

Added in 43.2.1
public void RemoveReaction(string reactionType)

Remove the specified reaction from this agent.

ParameterTypeDescription
reactionTypestringA 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$.

ParameterTypeDescription
messagestringThe 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.

ParameterTypeDescription
messagestringThe message to send.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

Messages may be throttled and ignored.

SetAllowFlight

New in 47.10.0
public void SetAllowFlight(bool allowFlight)

Sets whether flying is available for this agent.

ParameterTypeDescription
allowFlightboolTrue 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.

New in 47.10.0
public void SetAllowFlight(     bool allowFlight,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets whether flying is available for this agent.

ParameterTypeDescription
allowFlightboolTrue to allow this agent to fly, false to prevent it.
handlerAction<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

New in 47.10.0
public void SetColorLut(TextureResource lut)

Overrides the color LUT for this agent alone.

ParameterTypeDescription
lutTextureResourceThe 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.

New in 47.10.0
public void SetColorLut(     TextureResource lut,     Action<Sansar.Script.OperationCompleteEvent> handler )

Overrides the color LUT for this agent alone.

ParameterTypeDescription
lutTextureResourceThe LUT texture to grade this agent’s view with, or null to clear the override.
handlerAction<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

Added in 34.2.0
public void SetGravityFactor(float gravityFactor)

Sets what factor of the world’s gravity is applied to this agent.

ParameterTypeDescription
gravityFactorfloatThe 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.

Added in 34.2.0
public void SetGravityFactor(     float gravityFactor,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets what factor of the world’s gravity is applied to this agent.

ParameterTypeDescription
gravityFactorfloatThe gravityFactor. Default value is 1, range is clamped between -2 to 2
handlerAction<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

Added in 47.1.1
public void SetRagdollBounce(float bounce)

Sets the bounciness of the ragdoll body.

ParameterTypeDescription
bouncefloatBounce 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.

Added in 47.1.1
public void SetRagdollBounce(     float bounce,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets the bounciness of the ragdoll body.

ParameterTypeDescription
bouncefloatBounce factor from 0 (no bounce) to 1 (maximum bounce). Default is 0.
handlerAction<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

Added in 47.1.1
public void SetRagdollEnabled(bool enabled)

Enables or disables ragdoll physics on this agent.

ParameterTypeDescription
enabledboolTrue 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.

Added in 47.1.1
public void SetRagdollEnabled(     bool enabled,     Action<Sansar.Script.OperationCompleteEvent> handler )

Enables or disables ragdoll physics on this agent.

ParameterTypeDescription
enabledboolTrue to enable ragdoll, false to disable.
handlerAction<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.

Added in 47.1.1
public void SetRagdollEnabled(     bool enabled,     float autoRecoverDelaySeconds )

Enables or disables ragdoll physics on this agent and sets the auto-recovery delay.

ParameterTypeDescription
enabledboolTrue to enable ragdoll, false to disable.
autoRecoverDelaySecondsfloatSeconds 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.

Added in 47.1.1
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.

ParameterTypeDescription
enabledboolTrue to enable ragdoll, false to disable.
autoRecoverDelaySecondsfloatSeconds before auto-recovery begins. Set to 0 to disable auto-recovery.
handlerAction<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

Added in 47.1.1
public void SetScaleFactor(float scaleFactor)

Sets a runtime scale factor for this agent.

ParameterTypeDescription
scaleFactorfloatThe 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.

Added in 47.1.1
public void SetScaleFactor(     float scaleFactor,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets a runtime scale factor for this agent.

ParameterTypeDescription
scaleFactorfloatThe scaleFactor. Default value is 1, range is clamped between 0.01 to 100
handlerAction<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

Added in 47.1.1
public void SetScaleFactorAnimated(float scaleFactor, float seconds)

Sets a runtime scale factor for this agent, interpolating smoothly over the given duration.

ParameterTypeDescription
scaleFactorfloatThe target scaleFactor. Range is clamped between 0.01 to 100
secondsfloatThe 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.

Added in 47.1.1
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.

ParameterTypeDescription
scaleFactorfloatThe target scaleFactor. Range is clamped between 0.01 to 100
secondsfloatThe duration in seconds over which to interpolate. If 0 or negative, the change is instant.
handlerAction<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

Added in 36.8.0
public void SetSpeedFactor(float speedFactor)

Sets what factor of the base speed to apply to this agent.

ParameterTypeDescription
speedFactorfloatThe 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.

Added in 36.8.0
public void SetSpeedFactor(     float speedFactor,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets what factor of the base speed to apply to this agent.

ParameterTypeDescription
speedFactorfloatThe speedFactor. Default value is 1, range is clamped between 0.1 to 4
handlerAction<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

…and 29 more examples in the snapshot.

Generated from the Sansar 47.10.0 client ScriptApi snapshot.