SkinnedModelRendererclass

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

object→ModelRenderer→SkinnedModelRenderer
Namespace
Sandbox
Assembly
Sandbox.Engine
Declaration
public sealed class Sandbox.SkinnedModelRenderer : Sandbox.ModelRenderer

Constructors1

Showing 1 constructors

Methods34

Showing 34 methods

public void ClearIk(string name)PUBLIC

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

ParameterTypeDescription
namestring—
Returns:void—

public void ClearParameters()PUBLIC

Remove any stored parameters

Returns:void—

public void ClearPhysicsBones()PUBLIC

Returns:void—

public System.Nullable`1<Transform> GetAttachment(string name, bool worldSpace = True)PUBLIC

ParameterTypeDescription
namestring—
worldSpace = Truebool—
Returns:Nullable<Transform>—

public Transform[] GetBoneTransforms(bool world)PUBLIC

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

ParameterTypeDescription
worldbool—
Returns:Transform[]—

public bool GetBool(string v)PUBLIC

ParameterTypeDescription
vstring—
Returns:bool—

public Sandbox.BoneCollection.Bone GetClosestBone(Vector3 worldPoint)PUBLIC

The bone closest to a world position, or null when there's no model. Resolved natively in one call - nothing is allocated or copied. Use for sticking things to the nearest bone (impact decals, gibs).

ParameterTypeDescription
worldPointVector3—
Returns:Bone—

public float GetFloat(string v)PUBLIC

ParameterTypeDescription
vstring—
Returns:float—

public int GetInt(string v)PUBLIC

ParameterTypeDescription
vstring—
Returns:int—

public Rotation GetRotation(string v)PUBLIC

ParameterTypeDescription
vstring—
Returns:Rotation—

public Vector3 GetVector(string v)PUBLIC

ParameterTypeDescription
vstring—
Returns:Vector3—

public void PostAnimationUpdate()PUBLICPER-FRAMEOBSOLETE

Obsolete: This API member is obsolete.

Returns:void—

public void SetIk(string name, Transform tx)PUBLIC

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

ParameterTypeDescription
namestring—
txTransform—
Returns:void—

public bool TryGetBoneTransformAnimation(Sandbox.BoneCollection.Bone bone, Transform tx)PUBLIC

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

ParameterTypeDescription
boneBone—
txTransform—
Returns:bool—

Properties21

Showing 21 properties

public System.ReadOnlySpan`1<Transform> Sandbox.SkinnedModelRenderer.BoneWorldTransforms { get; set; }PUBLICGETSET

This frame's final world-space bone transforms, cached so repeated callers - and parallel readers - share a single skeleton read instead of each fetching bones one at a time. Rebuilt at most once per frame. The returned data is shared and must not be mutated. Empty if there's no valid model.

Returns:ReadOnlySpan<Transform>—

public bool Sandbox.SkinnedModelRenderer.PlayAnimationsInEditorScene { get; set; }PUBLICGETSET

If true then animations will play while in an editor scene.

Returns:bool—

public float Sandbox.SkinnedModelRenderer.PlaybackRate { get; set; }PUBLICGETSET

Control playback rate of animgraph or current sequence.

Returns:float—

public System.ReadOnlySpan`1<Transform> Sandbox.SkinnedModelRenderer.PreviousBoneWorldTransforms { get; set; }PUBLICGETSET

Last frame's final world-space bone transforms - the counterpart to `Sandbox.SkinnedModelRenderer.BoneWorldTransforms`, so consumers can tell how each bone moved this frame without tracking it themselves.

Returns:ReadOnlySpan<Transform>—

public bool Sandbox.SkinnedModelRenderer.ShouldShowMorphsEditor { get; set; }PUBLICGETSET

Returns:bool—

public bool Sandbox.SkinnedModelRenderer.ShouldShowParametersEditor { get; set; }PUBLICGETSET

Returns:bool—

public bool Sandbox.SkinnedModelRenderer.ShouldShowSequenceEditor { get; set; }PUBLICGETSET

Returns:bool—

public bool Sandbox.SkinnedModelRenderer.UseAnimGraph { get; set; }PUBLICGETSET

Usually used for turning off animation on ragdolls.

Returns:bool—

On this page

Constructorspublic SkinnedModelRenderer()Methodspublic System.Void ClearIk(System.String name)public System.Void ClearParameters()public System.Void ClearPhysicsBones()public System.Nullable`1<Transform> GetAttachment(System.String name, System.Boolean worldSpace = True)public virtual Sandbox.GameObject GetBoneObject(Sandbox.BoneCollection.Bone bone)public Sandbox.GameObject GetBoneObject(System.Int32 index)public Sandbox.GameObject GetBoneObject(System.String boneName)public Transform[] GetBoneTransforms(System.Boolean world)public Sandbox.SkinnedModelRenderer.BoneVelocity[] GetBoneVelocities()public Sandbox.SkinnedModelRenderer.BoneVelocity GetBoneVelocity(System.Int32 boneIndex)public System.Boolean GetBool(System.String v)public Sandbox.BoneCollection.Bone GetClosestBone(Vector3 worldPoint)public System.Single GetFloat(System.String v)public System.Int32 GetInt(System.String v)public Rotation GetRotation(System.String v)public Vector3 GetVector(System.String v)public System.Void PostAnimationUpdate()public System.Void Set(System.String v, Rotation value)public System.Void Set(System.String v, System.Boolean value)public System.Void Set(System.String v, System.Int32 value)public System.Void Set(System.String v, System.Single value)public System.Void Set(System.String v, System.String option)public System.Void Set(System.String v, Vector3 value)public System.Void SetBoneTransform(Sandbox.BoneCollection.Bone bone, Transform transform)public System.Void SetIk(System.String name, Transform tx)public System.Void SetLookDirection(System.String name, Vector3 eyeDirectionWorld, System.Single weight)public System.Void SetLookDirection(System.String name, Vector3 eyeDirectionWorld)public Sandbox.SoundHandle SpeakSound(Sandbox.SoundEvent sound, Sandbox.GameObject mouth = null)public Sandbox.SoundHandle SpeakSound(Sandbox.SoundFile sound, System.Single volume = 1, System.Single pitch = 1, Sandbox.GameObject mouth = null)public System.Boolean TryGetBoneTransform(Sandbox.BoneCollection.Bone bone, Transform tx)public System.Boolean TryGetBoneTransform(System.String boneName, Transform tx)public System.Boolean TryGetBoneTransformAnimation(Sandbox.BoneCollection.Bone bone, Transform tx)public System.Boolean TryGetBoneTransformLocal(Sandbox.BoneCollection.Bone bone, Transform tx)public System.Boolean TryGetBoneTransformLocal(System.String boneName, Transform tx)Propertiespublic Sandbox.AnimationGraph Sandbox.SkinnedModelRenderer.AnimationGraph { get; set; }public Sandbox.SkinnedModelRenderer Sandbox.SkinnedModelRenderer.BoneMergeTarget { get; set; }public System.ReadOnlySpan`1<Transform> Sandbox.SkinnedModelRenderer.BoneWorldTransforms { get; set; }public System.Boolean Sandbox.SkinnedModelRenderer.CreateBoneObjects { get; set; }public Sandbox.SkinnedModelRenderer.DeformationModeType Sandbox.SkinnedModelRenderer.DeformationMode { get; set; }public Sandbox.SkinnedModelRenderer.MorphAccessor Sandbox.SkinnedModelRenderer.Morphs { get; set; }public System.Action`1<Sandbox.SceneModel.AnimTagEvent> Sandbox.SkinnedModelRenderer.OnAnimTagEvent { get; set; }public System.Action`1<Sandbox.SceneModel.FootstepEvent> Sandbox.SkinnedModelRenderer.OnFootstepEvent { get; set; }public System.Action`1<Sandbox.SceneModel.GenericEvent> Sandbox.SkinnedModelRenderer.OnGenericEvent { get; set; }public System.Action`1<Sandbox.SceneModel.SoundEvent> Sandbox.SkinnedModelRenderer.OnSoundEvent { get; set; }public Sandbox.SkinnedModelRenderer.ParameterAccessor Sandbox.SkinnedModelRenderer.Parameters { get; set; }public System.Boolean Sandbox.SkinnedModelRenderer.PlayAnimationsInEditorScene { get; set; }public System.Single Sandbox.SkinnedModelRenderer.PlaybackRate { get; set; }public System.ReadOnlySpan`1<Transform> Sandbox.SkinnedModelRenderer.PreviousBoneWorldTransforms { get; set; }public Transform Sandbox.SkinnedModelRenderer.RootMotion { get; set; }public Sandbox.SceneModel Sandbox.SkinnedModelRenderer.SceneModel { get; set; }public Sandbox.SkinnedModelRenderer.SequenceAccessor Sandbox.SkinnedModelRenderer.Sequence { get; set; }public System.Boolean Sandbox.SkinnedModelRenderer.ShouldShowMorphsEditor { get; set; }public System.Boolean Sandbox.SkinnedModelRenderer.ShouldShowParametersEditor { get; set; }public System.Boolean Sandbox.SkinnedModelRenderer.ShouldShowSequenceEditor { get; set; }public System.Boolean Sandbox.SkinnedModelRenderer.UseAnimGraph { get; set; }Metadata