SceneModelclass

A model scene object that supports animations and can be rendered within a `Sandbox.SceneWorld`.

objectSceneObjectSceneModel
Namespace
Sandbox
Assembly
Sandbox.Engine
Declaration
public sealed class Sandbox.SceneModel : Sandbox.SceneObject

Constructors2

Showing 2 constructors

Methods31

Showing 31 methods

public void ClearBoneOverrides()PUBLIC

Clears all bone transform overrides.

Returns:void

public void DispatchTagEvents()PUBLIC

Returns:void

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

Get attachment transform by name.

ParameterTypeDescription
namestringName of the attachment to calculate transform of.
worldspace = TrueboolWhether the transform should be in world space (relative to the scene world), or local space (relative to the scene object)
Returns:Nullable<Transform>

public void GetBoneVelocity(int boneIndex, Vector3 linear, Vector3 angular)PUBLIC

Calculates the velocity from the previous and current bone transforms.

ParameterTypeDescription
boneIndexint
linearVector3
angularVector3
Returns:void

public bool GetBool(string name)PUBLIC

Get an animated parameter

ParameterTypeDescription
namestring
Returns:bool

public float GetFloat(string name)PUBLIC

Get an animated parameter

ParameterTypeDescription
namestring
Returns:float

public int GetInt(string name)PUBLIC

Get an animated parameter

ParameterTypeDescription
namestring
Returns:int

public Transform GetParentSpaceBone(int i)PUBLIC

Returns the parent space transform of a bone by its index.

ParameterTypeDescription
iintIndex of the bone to calculate transform of.
Returns:TransformThe parent space transform, or an identity transform on failure.

public Rotation GetRotation(string name)PUBLIC

Get an animated parameter

ParameterTypeDescription
namestring
Returns:Rotation

public Vector3 GetVector3(string name)PUBLIC

Get an animated parameter

ParameterTypeDescription
namestring
Returns:Vector3

public bool HasBoneOverrides()PUBLIC

Whether any bone transforms have been overridden.

Returns:bool

public void MergeBones(Sandbox.SceneModel parent)PUBLIC

Update our bones to match the target's bones. This is a manual bone merge.

ParameterTypeDescription
parentSceneModel
Returns:void

public void ResetAnimParameters()PUBLIC

Reset all animgraph parameters to their default values.

Returns:void

public void RunPendingEvents()PUBLIC

Returns:void

public void SetAnimGraph(string name)PUBLICOBSOLETE

Override the anim graph this scene model uses

Obsolete: Can use AnimationGraph directly

ParameterTypeDescription
namestring
Returns:void

public void SetBodyGroup(string name, int value)PUBLIC

Set which body group to use.

ParameterTypeDescription
namestring
valueint
Returns:void

public void SetBoneOverride(int boneIndex, Transform transform)PUBLIC

Manually override the final bone transform.

ParameterTypeDescription
boneIndexint
transformTransformLocal coordinates based on the SceneModel's transform
Returns:void

public void SetBoneWorldTransform(int boneIndex, Transform transform)PUBLIC

Sets the world space bone transform of a bone by its index.

ParameterTypeDescription
boneIndexintBone index to set transform of.
transformTransform
Returns:void

public void SetMaterialGroup(string name)PUBLIC

Set material group to replace materials of the model as set up in ModelDoc.

ParameterTypeDescription
namestring
Returns:void

public void Update(float delta)PUBLICPER-FRAME

Update this animation. Delta is the time you want to advance, usually RealTime.Delta

ParameterTypeDescription
deltafloat
Returns:void

public void UpdateToBindPose()PUBLICPER-FRAME

Update all of the bones to the bind pose

Returns:void

Properties11

Showing 11 properties

public Sandbox.AnimationSequence Sandbox.SceneModel.CurrentSequence { get; set; }PUBLICGETSET

Allows playback of sequences directly, rather than using an animation graph. Requires `Sandbox.SceneModel.UseAnimGraph` disabled if the scene model has one.

public Sandbox.AnimGraphDirectPlayback Sandbox.SceneModel.DirectPlayback { get; set; }PUBLICGETSET

Access this sceneobject's direct playback. Direct playback is used to control the direct playback node in an animgraph to play sequences directly in code

public Sandbox.MorphCollection Sandbox.SceneModel.Morphs { get; set; }PUBLICGETSET

Access this sceneobject's morph collection. Morphs are generally used in the model to control the face, for things like emotions and lip sync.

Returns:MorphCollection

public System.Action`1<Sandbox.SceneModel.SoundEvent> Sandbox.SceneModel.OnSoundEvent { get; set; }PUBLICGETSET

Called when a sound event happens

Returns:Action<SoundEvent>

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

Returns:float

public Transform Sandbox.SceneModel.RootMotion { get; set; }PUBLICGETSET

Get the calculated motion from animgraph since last frame

Returns:Transform

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

Allows the scene model to not use the anim graph so it can play sequences directly

Returns:bool

On this page

Constructorspublic SceneModel(Sandbox.SceneWorld sceneWorld, Sandbox.Model model, Transform transform)public SceneModel(Sandbox.SceneWorld sceneWorld, System.String model, Transform transform)Methodspublic System.Void ClearBoneOverrides()public System.Void DispatchTagEvents()public System.Nullable`1<Transform> GetAttachment(System.String name, System.Boolean worldspace = True)public Transform GetBoneLocalTransform(System.Int32 boneIndex)public Transform GetBoneLocalTransform(System.String boneName)public System.Void GetBoneVelocity(System.Int32 boneIndex, Vector3 linear, Vector3 angular)public Transform GetBoneWorldTransform(System.Int32 boneIndex)public Transform GetBoneWorldTransform(System.String boneName)public System.Boolean GetBool(System.String name)public System.Single GetFloat(System.String name)public System.Int32 GetInt(System.String name)public Transform GetParentSpaceBone(System.Int32 i)public Rotation GetRotation(System.String name)public Vector3 GetVector3(System.String name)public System.Boolean HasBoneOverrides()public System.Void MergeBones(Sandbox.SceneModel parent)public System.Void ResetAnimParameters()public System.Void RunPendingEvents()public System.Void SetAnimGraph(System.String name)public System.Void SetAnimParameter(System.String name, Rotation value)public System.Void SetAnimParameter(System.String name, System.Boolean value)public System.Void SetAnimParameter(System.String name, System.Int32 value)public System.Void SetAnimParameter(System.String name, System.Single value)public System.Boolean SetAnimParameter(System.String name, System.String option)public System.Void SetAnimParameter(System.String name, Vector3 value)public System.Void SetBodyGroup(System.String name, System.Int32 value)public System.Void SetBoneOverride(System.Int32 boneIndex, Transform transform)public System.Void SetBoneWorldTransform(System.Int32 boneIndex, Transform transform)public System.Void SetMaterialGroup(System.String name)public System.Void Update(System.Single delta)public System.Void UpdateToBindPose()Propertiespublic Sandbox.AnimationGraph Sandbox.SceneModel.AnimationGraph { get; set; }public Sandbox.AnimationSequence Sandbox.SceneModel.CurrentSequence { get; set; }public Sandbox.AnimGraphDirectPlayback Sandbox.SceneModel.DirectPlayback { get; set; }public Sandbox.MorphCollection Sandbox.SceneModel.Morphs { get; set; }public System.Action`1<Sandbox.SceneModel.AnimTagEvent> Sandbox.SceneModel.OnAnimTagEvent { get; set; }public System.Action`1<Sandbox.SceneModel.FootstepEvent> Sandbox.SceneModel.OnFootstepEvent { get; set; }public System.Action`1<Sandbox.SceneModel.GenericEvent> Sandbox.SceneModel.OnGenericEvent { get; set; }public System.Action`1<Sandbox.SceneModel.SoundEvent> Sandbox.SceneModel.OnSoundEvent { get; set; }public System.Single Sandbox.SceneModel.PlaybackRate { get; set; }public Transform Sandbox.SceneModel.RootMotion { get; set; }public System.Boolean Sandbox.SceneModel.UseAnimGraph { get; set; }Metadata