Skip to content

Get Sansar

Script API

CharacterComponent

Where: Client
More page actions

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

Class Namespace Sansar.Simulation Inherits Sansar.Script.InstanceInterface Added in 39.1.0

The CharacterComponent handles character specific operations like playing CharacterAnimations.

public class CharacterComponent : Sansar.Script.InstanceInterface

Remarks

Allows for doing operations specific to characters using the Sansar skeleton types

Members at a glance

KindMembers
FieldsComponentType
PropertiesComponentId · UsingFemaleSkeleton · UsingMaleSkeleton
MethodsPlayAnimation · StopAnimations · ToString

Fields

ComponentType

Added in 39.1.0
public static readonly ComponentType ComponentType

The CharacterComponent.ComponentType of this component

Properties

ComponentId

Added in 39.1.0
public Sansar.Script.ComponentId ComponentId { get; }

Retrieves the component id for this CharacterComponent.

Value: Sansar.Script.ComponentId — The id.

UsingFemaleSkeleton

Added in 39.1.0
public bool UsingFemaleSkeleton { get; }

Retrieves whether or not the avatar is using the female skeleton for this CharacterComponent.

Value: bool — Whether or not the avatar is using the female skeleton

UsingMaleSkeleton

Added in 39.1.0
public bool UsingMaleSkeleton { get; }

Retrieves whether or not the avatar is using the male skeleton for this CharacterComponent.

Value: bool — Whether or not the avatar is using the male skeleton

Methods

PlayAnimation

Added in 39.1.0
public void PlayAnimation(     CharacterAnimation animation,     AnimationPlaybackMode playbackMode,     AnimationBoneSubset skeletonSubset )

Plays an animation in server time synchronously for this CharacterComponent. If you want multiple agent’s to play an animation together, use this function

ParameterTypeDescription
animationCharacterAnimationThe animation to play on the agent.
playbackModeAnimationPlaybackModeHow to play the animation. Only PlayOnce and Loop supported.
skeletonSubsetAnimationBoneSubsetWhich subset of the skeleton to play the animation on.
Remarks

This asynchronous method queues the write then returns.

Added in 39.1.0
public void PlayAnimation(     CharacterAnimation animation,     AnimationPlaybackMode playbackMode,     AnimationBoneSubset skeletonSubset,     Action<Sansar.Script.OperationCompleteEvent> handler )

Plays an animation in server time synchronously for this CharacterComponent. If you want multiple agent’s to play an animation together, use this function

ParameterTypeDescription
animationCharacterAnimationThe animation to play on the agent.
playbackModeAnimationPlaybackModeHow to play the animation. Only PlayOnce and Loop supported.
skeletonSubsetAnimationBoneSubsetWhich subset of the skeleton to play the animation on.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

This asynchronous method queues the write then returns.

Added in 39.1.0
public void PlayAnimation(     CharacterAnimation animation,     AnimationPlaybackMode playbackMode,     AnimationBoneSubset skeletonSubset,     float playbackSpeed )

Plays an animation in server time synchronously for this CharacterComponent. If you want multiple agent’s to play an animation together, use this function

ParameterTypeDescription
animationCharacterAnimationThe animation to play on the agent.
playbackModeAnimationPlaybackModeHow to play the animation. Only PlayOnce and Loop supported.
skeletonSubsetAnimationBoneSubsetWhich subset of the skeleton to play the animation on.
playbackSpeedfloatAnimation playback speed. Must be betweeen 0.1 and 10.
Remarks

This asynchronous method queues the write then returns.

Added in 39.1.0
public void PlayAnimation(     CharacterAnimation animation,     AnimationPlaybackMode playbackMode,     AnimationBoneSubset skeletonSubset,     float playbackSpeed,     Action<Sansar.Script.OperationCompleteEvent> handler )

Plays an animation in server time synchronously for this CharacterComponent. If you want multiple agent’s to play an animation together, use this function

ParameterTypeDescription
animationCharacterAnimationThe animation to play on the agent.
playbackModeAnimationPlaybackModeHow to play the animation. Only PlayOnce and Loop supported.
skeletonSubsetAnimationBoneSubsetWhich subset of the skeleton to play the animation on.
playbackSpeedfloatAnimation playback speed. Must be betweeen 0.1 and 10.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

This asynchronous method queues the write then returns.

StopAnimations

Added in 39.1.0
public void StopAnimations()

Stops all animations in server time synchronously for this CharacterComponent. If you want multiple agent’s to stop animations together, use this function

Remarks

This asynchronous method queues the write then returns.

Added in 39.1.0
public void StopAnimations(AnimationBoneSubset skeletonSubset)

Stops all animations in server time synchronously for this CharacterComponent. If you want multiple agent’s to stop animations together, use this function

ParameterTypeDescription
skeletonSubsetAnimationBoneSubsetAll Animations for this skeleton subset will be stopped.
Remarks

This asynchronous method queues the write then returns.

Added in 39.1.0
public void StopAnimations(     Action<Sansar.Script.OperationCompleteEvent> handler )

Stops all animations in server time synchronously for this CharacterComponent. If you want multiple agent’s to stop animations together, use this function

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

This asynchronous method queues the write then returns.

Added in 39.1.0
public void StopAnimations(     AnimationBoneSubset skeletonSubset,     Action<Sansar.Script.OperationCompleteEvent> handler )

Stops all animations in server time synchronously for this CharacterComponent. If you want multiple agent’s to stop animations together, use this function

ParameterTypeDescription
skeletonSubsetAnimationBoneSubsetAll Animations for this skeleton subset will be stopped.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

This asynchronous method queues the write then returns.

ToString

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

Generated from the Sansar 47.10.0 client ScriptApi snapshot.