The CharacterComponent handles character specific operations like playing CharacterAnimations.
public class CharacterComponent : Sansar.Script.InstanceInterfaceRemarks
Allows for doing operations specific to characters using the Sansar skeleton types
Members at a glance
| Kind | Members |
|---|---|
| Fields | ComponentType |
| Properties | ComponentId · UsingFemaleSkeleton · UsingMaleSkeleton |
| Methods | PlayAnimation · StopAnimations · ToString |
Fields
ComponentType
public static readonly ComponentType ComponentTypeThe CharacterComponent.ComponentType of this component
Properties
ComponentId
public Sansar.Script.ComponentId ComponentId { get; }Retrieves the component id for this CharacterComponent.
Value: Sansar.Script.ComponentId — The id.
UsingFemaleSkeleton
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
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
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
| Parameter | Type | Description |
|---|---|---|
animation | CharacterAnimation | The animation to play on the agent. |
playbackMode | AnimationPlaybackMode | How to play the animation. Only PlayOnce and Loop supported. |
skeletonSubset | AnimationBoneSubset | Which subset of the skeleton to play the animation on. |
Remarks
This asynchronous method queues the write then returns.
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
| Parameter | Type | Description |
|---|---|---|
animation | CharacterAnimation | The animation to play on the agent. |
playbackMode | AnimationPlaybackMode | How to play the animation. Only PlayOnce and Loop supported. |
skeletonSubset | AnimationBoneSubset | Which subset of the skeleton to play the animation on. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
This asynchronous method queues the write then returns.
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
| Parameter | Type | Description |
|---|---|---|
animation | CharacterAnimation | The animation to play on the agent. |
playbackMode | AnimationPlaybackMode | How to play the animation. Only PlayOnce and Loop supported. |
skeletonSubset | AnimationBoneSubset | Which subset of the skeleton to play the animation on. |
playbackSpeed | float | Animation playback speed. Must be betweeen 0.1 and 10. |
Remarks
This asynchronous method queues the write then returns.
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
| Parameter | Type | Description |
|---|---|---|
animation | CharacterAnimation | The animation to play on the agent. |
playbackMode | AnimationPlaybackMode | How to play the animation. Only PlayOnce and Loop supported. |
skeletonSubset | AnimationBoneSubset | Which subset of the skeleton to play the animation on. |
playbackSpeed | float | Animation playback speed. Must be betweeen 0.1 and 10. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
This asynchronous method queues the write then returns.
StopAnimations
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.
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
| Parameter | Type | Description |
|---|---|---|
skeletonSubset | AnimationBoneSubset | All Animations for this skeleton subset will be stopped. |
Remarks
This asynchronous method queues the write then returns.
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
| Parameter | Type | Description |
|---|---|---|
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
This asynchronous method queues the write then returns.
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
| Parameter | Type | Description |
|---|---|---|
skeletonSubset | AnimationBoneSubset | All Animations for this skeleton subset will be stopped. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
This asynchronous method queues the write then returns.
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
Generated from the Sansar 47.10.0 client ScriptApi snapshot.