S&box Wiki
Home
/
Edit IKChains and Stride Retargeting
View
Edit
History
No Category
Developer Overview
The Project System
Publishing To Asset Party
Getting Started With Hammer
Mapping Basics
Mapping Entities
Advanced Mapping Techniques
Getting Started with Modeldoc
Animgraph & Animation
Physics
Modeldoc Nodes
Advanced Modelling
UI Basics
Styles & Stylesheets
Razor Templates
Game Menus
Materials
Built In Shaders
Shaders
Shader Reference
Sounds & Audio
Particles
Getting Started
Making Games
Input
Networking
Physics
Rendering
Editor & Tools
VR
Misc
Playing Guides
Console Commands & Variables
Dedicated Server
Log in to edit
IKChains and Stride Retargeting
<cat>Model.Advanced</cat> <title>IKChains and Stride Retargeting</title> <note> This guide is in need of a rework, as it does not explain how to use IKChains correctly, use at your own volition.</note> This guide will serve as an entry-level tutorial for adding all the required modifications to a model, its armature, and its animations before being able to use Source 2's IKChain and Stride Retargeting systems. # Armature and Animation Changes in Blender IKChains in Source 2 work as they do in many animation programs, they require ***"target"*** bones outside of the feet's hierarchy, sharing no parents, these targets are superimposed onto the feet at all times, so the animations will need to be modified to reflect that. To create the target bones the process in *"Blender"* is as follows: 1. Select the model's armature and switch to **Edit Mode** with <key>Tab</key> 2. Create a new bone with <key>Alt</key>+<key>A</key>, name accordingly in the **Bone Properties** panel *(I'll use "root")* 3. Select the *root* bone and **Extrude** a new bone with <key>E</key>, press <key>Z</key> and have the bones go upwards 4. Name them in the **Bone Properties** panel, then **Relations** > uncheck the *"Connected"* box 5. Repeat *step 3* and *step 4* for every foot needed 6. Export your model <upload src="a4aaf/8d9073253bb4b50.png" size="114480" name="1.png" /> *`shown are the root bone and 2 target bones (selected in pose mode), the position in edit mode is arbitrary.`* In step 3, the size of the bones is irrelevant as the engine doesn't support bone size, the direction of the bone, however, is important, not particularly in this process but it's good to keep the bones axis aligned, additionally, in Blender, you can press <key>SHIFT + N</key> to align the roll too. In Source 2, only the base of the bone is used, but Blender also gives the bone a head, that is why the size doesn't change when moving the head but the direction does; Shown below are the 2 separate hierarchies. <upload src="a4aaf/8d90733ec8320e4.png" size="5825" name="2.png" /> --- ## Animations Now the targets will need to follow the feet in the animations, do this for each non-additive animation that contains any foot movement, including idle: 1. Select the armature and switch to **Pose Mode** 2. Select the target bones and go to the **Bone Constraints** panel 3. Add a *"Copy Location"* constraint 4. Select the armature as the *"Target"* > Select the respective foot bone as the *"Bone"* 5. Repeat for all the bones, making sure the *"Influence"* slider stays at 1 <upload src="a4aaf/8d90735ea2c36da.png" size="95813" name="3.png" /> *`This will result in the target bones following the foot bones throughout any movement.`* 6. Still in **Pose Mode**, select all bones with <key>A</key> 7. On the top-left of the viewport display, select **Pose** > **Animation** > **Bake Action** 8. Check the *"Visual Keying"* box > Check the *"Clear Constraints"* box > **Ok** 9. Export your animation <upload src="a4aaf/8d907383c478151.png" size="151091" name="4.png" /> --- # IKChains and Feet in ModelDoc For **IKChains** to work in the AnimGraph editor, a model just needs IKChains added in the ModelDoc, however, to use **Stride Retargeting** you also need to specify a **"Foot"**, Stride Retargeting incorporates the foot locking function of regular IKChains while also calculating how to move the foot accordingly during the animation. 1. Add an **"IKChain"** 2. Select the foot as the *"End effector bone"* > **Ok** 3. Change *"Target Bone"* from the foot to the **Target Bone** 4. Compile the model <upload src="a4aaf/8d907757d67845b.png" size="179777" name="9.png" /> --- ## Feet Valve has very specific nomenclature, for example, what would commonly be called the foot bone is called ankle, the **"Foot"** parameter also contains a *"Heel Offset"* value and a *"Ball Offset" value, the [ball](https://en.wikipedia.org/wiki/Ball_(foot)#:~:text=The%20ball%20of%20the%20foot,serves%20mostly%20the%20same%20functions.) being the name for the padded part of the foot that touches the ground that's not the heel, under the toe joints. 1. Add a **"Foot"** 2. Select the foot as the *"Ankle Bone"* 3. If your model has a toe bone, select that as *"Toe Bone"* *(optional)* 4. Place the *"Ball Offset"* where the ball would touch the ground 5. Place the *"Heel Offset"* where the heel would touch the ground 6. Repeat for all feet 7. Compile the model <upload src="a4aaf/8d90778b0503050.png" size="311204" name="11.png" /> *`Trace Height and Trace Radius are mostly fine with the default values`* --- # Stride Retargeting node in the AnimGraph Editor <deprecated>This feature relies heavily on paths and motors, which were prevalently used in Half-Life: Alyx, but have fallen out of use for various reasons in S&box, use at your own risk.</deprecated> Stride Retargeting is best used for applying small corrections, so use it in conjunction with either strafing or standing turns, the biped example animgraph in the intro contains both, useful for NPCs or Players; Set up a basic AnimGraph: 1. Add a *"Stride Retargeting"* node 2. In **"Feet"**: Add as many Feet as needed by pressing the **<key>+</key>** icon 3. Use the dropdown lists to fill *"Foot"*, *"Target Bone"* and *"IK Chain"* accordingly 4. Repeat *step 3* for all feet 5. In **"Ground IK"**: Check the *"Enable Ground Tracing"* box <upload src="a4aaf/8d90803d0f90e5a.png" size="40302" name="14.png" /> --- ## Parking the Feet When transitioning into idle the IKChain may leave the model in an awkward pose, to make sure feet are reset correctly you'll need to enable it in the state machine: 1. Open the **State Machine** used for transitioning into your *"idle"* animation 2. Select the transition arrow that points into your *"idle"* 3. In the **"Properties"**: check the *"Park Feet"* box <upload src="a4aaf/8d908262157db31.png" size="46299" name="13.png" /> --- ### End Result Since all parameters have detailed descriptions, the remaining steps are to work around which work best for your model and are subjective. The final result will see the feet move accordingly: <upload src="a4aaf/8d9082caa44f8fc.mp4" size="893964" name="huh.mp4" /> *`These example legs are only using a "walk forward" animation, and a path motor to drive it towards the set path, it is recommended to have multiple directional movements for strafing.`* <upload src="a4aaf/8d9082f2f9180c0.png" size="1755" name="striderr.png" /> ---
S&box Wiki
Development
Developer Overview
6
Editor Overview
General FAQ
System Requirements
The s&box wiki
Troubleshooting
Useful Links
The Project System
4
Adding Assets
Creating a Game Project
Project Settings Window - Games
Project Types
Publishing To Asset Party
2
Uploading assets
Uploading projects
Hammer
Getting Started With Hammer
3
Getting Started With Hammer
Making Your First Map
Mapping Resources
Mapping Basics
7
Cordons
Hotspot Materials
Selection Sets
Standard Mapping Dimensions
Tool Materials
Tools Visualisation Modes
Using Entities That Require a Mesh
Mapping Entities
2
Creating a Door
Light Entities
Advanced Mapping Techniques
8
Collaborating With Prefabs and Git
Instances
Prefabs
Quixel Bridge Plugin
Tilesets
Tilesets-Advanced
Tilesets-Proxies
VIS Optimizations
Models & Animation
Getting Started with Modeldoc
7
Automatic Model Setup
Breakpieces
Creating a Model
Guide to Models
Importing Rust Weapons
LODs
ModelDoc FAQ & best practices
Animgraph & Animation
4
Animations without Animgraph
AnimEvents, AnimGraph Tags, Attachments
Animgraph
Delta Animations
Physics
3
Cloth Physics
Collisions, Physics & Surface Types
Jiggle Bones
Modeldoc Nodes
1
Custom ModelDoc nodes
Advanced Modelling
6
Bodygroups
Citizen
First Person
IKChains and Stride Retargeting
Morphs
Vertex Normals
User Interface
UI Basics
7
Custom Fonts
Embedding Websites
Enabling Pointer Events
Events and Input
Localization
UI Basics
UI with Components
Styles & Stylesheets
1
Video Backgrounds
Razor Templates
4
A Razor Overview
Aliases and SetProperty Attributes
Generic Components
Templates
Game Menus
1
Making a Custom Pause Screen
Materials & Shaders
Materials
5
Guide to Materials
Material Attributes
Material Resources
Texture Settings
Using Dynamic Expressions
Built In Shaders
2
Foliage Shader
Glass Shader
Shaders
4
Compute Shaders
Constant Buffers
Material API
Shading Model
Shader Reference
5
Anatomy of Shader Files
Getting rid of Tex2D macros
Shader Reference
Shader States
Texture Format Cheat-Sheet
Other Assets
Sounds & Audio
4
Guide to Sounds
Sound Events
Sound Occlusion
Soundscapes
Particles
5
Creating animated sprites
Creating your first particle effect
Understanding Particle Editor
Using custom sprites
Using particle systems from C#
Coding
Getting Started
5
Cheat Sheet
Learning Resources
Setting up Rider
Setting up Visual Studio
Setting up Visual Studio Code
Making Games
2
Components
GameObjects
Input
4
Commands
ConVars
Input System
Speech Recognition
Networking
7
Auth Tokens
Http Requests
Lobby System
Networked Types
Networking Basics
RPCs
WebSockets
Physics
5
Collisions
Hitboxes
Joints
Traces
Triggers
Rendering
3
Render Tags
RenderHooks
Scenes
Editor & Tools
7
Creating a Tool
Custom Asset Types
Guide to Widgets
Hammer API
Hammer Gizmos
Hotload Performance
Widget Docking
VR
3
Getting Started
VR Input
VR Overlays
Misc
13
Asset Types
Attributes and Component Properties
Backend API
Cloud Assets in code
Code Accesslist
CPU Performance Profiling
DisplayInfo
FileSystem
Mounting assets at runtime
package/find
Setting Up A Navigation Mesh
Threaded Tasks
TypeLibrary
Playing
Playing Guides
3
Default Keybinds
Proton
s&box on macOS (Experimental)
Console Commands & Variables
1
Launch Arguments
Dedicated Server
1
Dedicated Servers