Class ViewmodelSceneNode
Namespace: ValveResourceFormat.Renderer.SceneNodes
Assembly: Renderer.dll
First-person viewmodel scene node (player arms, weapon items and legs) driven by animgraph 2 clips.
public class ViewmodelSceneNode : ModelSceneNodeInheritance
object ← SceneNode ← MeshCollectionNode ← ModelSceneNode ← ViewmodelSceneNode
Inherited Members
ModelSceneNode.Attachments, ModelSceneNode.GetChildFrame(string?), ModelSceneNode.HasAttachmentOrBone(string), ModelSceneNode.AttachNode(SceneNode, string, Vector3, Quaternion), ModelSceneNode.PlaceNode(SceneNode, string, Vector3), ModelSceneNode.GetAttachmentTransform(string), ModelSceneNode.GetAttachmentLocalTransform(Attachment, Skeleton, Matrix4x4[]), ModelSceneNode.AnimationController, ModelSceneNode.Animations, ModelSceneNode.ActiveMaterialGroup, ModelSceneNode.HasMeshes, ModelSceneNode.Delete(), ModelSceneNode.Update(Scene.UpdateContext), ModelSceneNode.GetSupportedRenderModes(), ModelSceneNode.SetMaterialGroup(string), ModelSceneNode.LoadAnimationClip(AnimationClip), ModelSceneNode.LoadAnimationClip(string), ModelSceneNode.SetAnimationByName(string, float, bool), ModelSceneNode.SetAnimationForWorldPreview(string), ModelSceneNode.SetAnimation(Animation?, float, bool), ModelSceneNode.GetReferenceMeshes(), ModelSceneNode.GetMeshGroups(), ModelSceneNode.GetMaterialGroups(), ModelSceneNode.GetActiveMeshGroups(), ModelSceneNode.SetActiveMeshGroups(IEnumerable<string>), ModelSceneNode.ActiveLod, ModelSceneNode.IsAutoLod, ModelSceneNode.SetOverrideLod(int?), MeshCollectionNode.RenderableMeshes, SceneNode.Tint, SceneNode.Alpha, SceneNode.TintAlpha, SceneNode.Transform, SceneNode.LayerName, SceneNode.LayerEnabled, SceneNode.Visible, SceneNode.BoundingBox, SceneNode.LocalBoundingBox, SceneNode.Name, SceneNode.Id, SceneNode.IsSelected, SceneNode.Flags, SceneNode.AdditionalFlags, SceneNode.RenderPasses, SceneNode.UpdateBuffers(Camera), SceneNode.Scene, SceneNode.Parent, SceneNode.Children, SceneNode.ParentAttachment, SceneNode.LocalTransform, SceneNode.SetParent(SceneNode?, string?, Matrix4x4?), SceneNode.GetChildFrame(string?), SceneNode.UpdateHierarchy(Scene.UpdateContext), SceneNode.GetRigidTransform(Matrix4x4), SceneNode.EnvMaps, SceneNode.ShaderEnvMapVisibility, SceneNode.LightingOrigin, SceneNode.OverlayRenderOrder, SceneNode.CubeMapPrecomputedHandshake, SceneNode.LightProbeVolumePrecomputedHandshake, SceneNode.LightProbeBinding, SceneNode.EntityData, SceneNode.EntityInstance, SceneNode.Update(Scene.UpdateContext), SceneNode.Simulation, SceneNode.Render(Scene.RenderContext), SceneNode.GetSupportedRenderModes(), SceneNode.SetRenderMode(string), SceneNode.Delete(), SceneNode.GetCameraDistance(Camera)
Properties
Arms
The player arms.
public ModelSceneNode Arms { get; }Property Value
DeployDuration
Gets how long after this item is drawn before it can be used, m_flDeployDuration in weapons.vdata. A second for everything here bar the rifle.
public float DeployDuration { get; }Property Value
Lag
Viewmodel sway, trailing the arms behind the view as it turns.
public ViewmodelSceneNode.ViewmodelLag Lag { get; }Property Value
ViewmodelSceneNode.ViewmodelLag
Legs
The player legs.
public ModelSceneNode Legs { get; set; }Property Value
SelectedItemIndex
The selected item slot.
public int SelectedItemIndex { get; set; }Property Value
ShowCrosshair
Gets a value indicating whether to draw the walk mode crosshair: the viewmodel is up (walk mode, camera attached to the eyes rather than orbiting) and the equipped item wants one.
public bool ShowCrosshair { get; }Property Value
TargetAnimation
Gets the currently selected animation path based on the active slot and state.
public string TargetAnimation { get; }Property Value
ViewmodelOffset
Viewmodel offset in viewmodel space (forward, right, up).
public Vector3 ViewmodelOffset { get; set; }Property Value
WeaponMaxSpeed
Gets the running speed the equipped item allows, in world units per second. These are max_player_speed from the CS weapon scripts: heavier guns slow the player down.
public float WeaponMaxSpeed { get; }Property Value
Methods
ProcessInput(UserInput, float)
Process input for the viewmodel, updating its transform to match the camera's orientation and position.
public void ProcessInput(UserInput input, float uptime)Parameters
input UserInput
uptime float
SelectPreviousItem()
Selects the previously selected item (used for quick weapon switching).
public void SelectPreviousItem()TryLoadCs2Viewmodel(Scene, EntitySystem)
Try to load the CS2 viewmodel, returning null if the necessary resources are not found.
public static ViewmodelSceneNode? TryLoadCs2Viewmodel(Scene scene, EntitySystem entitySystem)Parameters
scene Scene
The scene the viewmodel is drawn in.
entitySystem EntitySystem
The world its weapons spawn projectiles into.
Returns
The loaded viewmodel, or null when its resources are missing.
Update(UpdateContext)
Called each frame to update this node's state.
public override void Update(Scene.UpdateContext context)Parameters
context Scene.UpdateContext
The current update context.

