Api Sandbox SceneModel
class

SceneModel

public sealed class SceneModel : SceneObject

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

Constructors

SceneModel(SceneWorld sceneWorld, String model, Transform transform)
SceneModel(SceneWorld sceneWorld, Model model, Transform transform)

Properties

Name Type Description
AnimationGraph AnimationGraph
PlaybackRate Single
UseAnimGraph Boolean Allows the scene model to not use the anim graph so it can play sequences directly
RootMotion Transform Get the calculated motion from animgraph since last frame
CurrentSequence AnimationSequence Allows playback of sequences directly, rather than using an animation graph. Requires UseAnimGraph disabled if the scene model has one.
Morphs MorphCollection Access this sceneobject's morph collection. Morphs are generally used in the model to control the face, for things like emotions and lip sync.
DirectPlayback AnimGraphDirectPlayback 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
OnFootstepEvent Action<FootstepEvent> Called when a footstep event happens
OnGenericEvent Action<GenericEvent> Called when a generic event happens
OnSoundEvent Action<SoundEvent> Called when a sound event happens
OnAnimTagEvent Action<AnimTagEvent> Called when a anim tag event happens

Methods

Void SetBoneOverride(Int32 boneIndex, Transform transform)

Manually override the final bone transform.

boneIndex
transform — Local coordinates based on the SceneModel's transform
Void ClearBoneOverrides()

Clears all bone transform overrides.

Boolean HasBoneOverrides()

Whether any bone transforms have been overridden.

Void GetBoneVelocity(Int32 boneIndex, Vector3 linear, Vector3 angular)

Calculates the velocity from the previous and current bone transforms.

Void SetAnimGraph(String name)

Override the anim graph this scene model uses

Void SetBoneWorldTransform(Int32 boneIndex, Transform transform)

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

boneIndex — Bone index to set transform of.
transform
Transform GetBoneWorldTransform(Int32 boneIndex)

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

boneIndex — Index of the bone to calculate transform of.
returns — The world space transform, or an identity transform on failure.
Transform GetBoneWorldTransform(String boneName)

Returns the world space transform of a bone by its name.

boneName — Name of the bone to calculate transform of.
returns — The world space transform, or an identity transform on failure.
Transform GetBoneLocalTransform(Int32 boneIndex)

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

boneIndex — Index of the bone to calculate transform of.
returns — The local space transform, or an identity transform on failure.
Transform GetBoneLocalTransform(String boneName)

Returns the local space transform of a bone by its name.

boneName — Name of the bone to calculate transform of.
returns — The local space transform, or an identity transform on failure.
Void SetMaterialGroup(String name)

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

Void SetBodyGroup(String name, Int32 value)

Set which body group to use.

Transform? GetAttachment(String name, Boolean worldspace = True)

Get attachment transform by name.

name — Name of the attachment to calculate transform of.
worldspace — Whether the transform should be in world space (relative to the scene world), or local space (relative to the scene object)
Void RunPendingEvents()
Void DispatchTagEvents()
Void SetAnimParameter(String name, Boolean value)

Sets a boolean animation graph parameter by name.

Void SetAnimParameter(String name, Single value)

Sets a float animation graph parameter by name.

Void SetAnimParameter(String name, Vector3 value)

Sets a vector animation graph parameter by name.

Void SetAnimParameter(String name, Int32 value)

Sets a integer animation graph parameter by name.

Void SetAnimParameter(String name, Rotation value)

Sets a rotation animation graph parameter by name.

Void ResetAnimParameters()

Reset all animgraph parameters to their default values.

Rotation GetRotation(String name)

Get an animated parameter

Vector3 GetVector3(String name)

Get an animated parameter

Boolean GetBool(String name)

Get an animated parameter

Single GetFloat(String name)

Get an animated parameter

Int32 GetInt(String name)

Get an animated parameter

Void Update(Single delta)

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

Void UpdateToBindPose()

Update all of the bones to the bind pose

Void MergeBones(SceneModel parent)

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

Transform GetParentSpaceBone(Int32 i)

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

i — Index of the bone to calculate transform of.
returns — The parent space transform, or an identity transform on failure.
Assembly: Sandbox.Engine Namespace: Sandbox Full Name: Sandbox.SceneModel