Api Sandbox SkinnedModelRenderer
class

SkinnedModelRenderer

public sealed class SkinnedModelRenderer : ModelRenderer

Renders a skinned model in the world. A skinned model is any model with bones/animations.

Constructors

SkinnedModelRenderer()

Properties

Name Type Description
CreateBoneObjects Boolean
BoneMergeTarget SkinnedModelRenderer
UseAnimGraph Boolean Usually used for turning off animation on ragdolls.
AnimationGraph AnimationGraph Override animgraph, otherwise uses animgraph of the model.
Sequence SequenceAccessor Allows playback of sequences directly, rather than using an animation graph. Requires UseAnimGraph disabled if the scene model has one.
PlaybackRate Single Control playback rate of animgraph or current sequence.
SceneModel SceneModel
RootMotion Transform
PlayAnimationsInEditorScene Boolean If true then animations will play while in an editor scene.
OnFootstepEvent Action<FootstepEvent> Called when a footstep event happens
OnGenericEvent Action<GenericEvent> Called when a generic animation event happens
OnSoundEvent Action<SoundEvent> Called when a sound event happens
OnAnimTagEvent Action<AnimTagEvent> Called when an anim tag event happens
Morphs MorphAccessor Access to the morphs for this model
ShouldShowMorphsEditor Boolean
Parameters ParameterAccessor Access to the animgraph parameters for this model
ShouldShowParametersEditor Boolean
ShouldShowSequenceEditor Boolean

Methods

GameObject GetBoneObject(Int32 index)

Get the GameObject of a specific bone.

index
GameObject GetBoneObject(String boneName)

Find a bone's GameObject by bone name.

virtual GameObject GetBoneObject(Bone bone)
Boolean TryGetBoneTransform(String boneName, Transform tx)

Try to get the final worldspace bone transform.

Boolean TryGetBoneTransform(Bone bone, Transform tx)

Try to get the final worldspace bone transform.

Boolean TryGetBoneTransformLocal(String boneName, Transform tx)
Boolean TryGetBoneTransformLocal(Bone bone, Transform tx)
Boolean TryGetBoneTransformAnimation(Bone bone, Transform tx)

Try to get the worldspace bone transform after animation but before physics and procedural bones.

Void SetBoneTransform(Bone bone, Transform transform)
Void ClearPhysicsBones()
Transform[] GetBoneTransforms(Boolean world)

Allocate an array of bone transforms in either world space or parent space.

BoneVelocity[] GetBoneVelocities()

Allocate an array of bone velocities in world space

BoneVelocity GetBoneVelocity(Int32 boneIndex)

Retrieve the bone's velocities based on previous and current position

Void PostAnimationUpdate()
Transform? GetAttachment(String name, Boolean worldSpace = True)
Void Set(String v, Vector3 value)
Void Set(String v, Int32 value)
Void Set(String v, Single value)
Void Set(String v, Boolean value)
Void Set(String v, Rotation value)
Void ClearParameters()

Remove any stored parameters

Boolean GetBool(String v)
Int32 GetInt(String v)
Single GetFloat(String v)
Vector3 GetVector(String v)
Rotation GetRotation(String v)
Void SetLookDirection(String name, Vector3 eyeDirectionWorld)

Converts value to vector local to this entity's eyepos and passes it to SetAnimVector

Void SetLookDirection(String name, Vector3 eyeDirectionWorld, Single weight)

Converts value to vector local to this entity's eyepos and passes it to SetAnimVector. This also sets {name}_weight to the weight value.

Void SetIk(String name, Transform tx)

Sets an IK parameter. This sets 3 variables that should be set in the animgraph: 1. ik.{name}.enabled 2. ik.{name}.position 3. ik.{name}.rotation

Void ClearIk(String name)

This sets ik.{name}.enabled to false.

Assembly: Sandbox.Engine Namespace: Sandbox Full Name: Sandbox.SkinnedModelRenderer