Source 2 Animation System VScript API/CModelVScriptCompile.CreateIKChain

From Valve Developer Community
Jump to: navigation, search

Function Description

int CModelVScriptCompile::CreateSequence(string chainName, string end_bone, table parameters)

Creates an Inverse Kinematics chain, similar to the $ikchain QC command. The function only seems be available in run-time animation VScripts. Several IK solvers seem to be available, including Ken Perlin's two bone solver and the FABRIK solver.

Blank image.pngTodo: Unknown how much of this works.

Parameters

Type Name Description
string chainName Name to refer to the chain by.
table parameters IK chain parameters (see below).

Returns

int - Index of the IK chain.

Sequence Parameters

The parameters are added as keys in the parameters table.

Blank image.pngTodo: This list is likely wrong and incomplete.
Name Type Description
bones_point_along_positive_x boolean Blank image.pngTodo:

constraints array List of IK constraints. Syntax: { { < type = "$" >, ... }, ... }
ik_root_bone string Name of the first bone in the IK chain. Required.
ik_end_effector_bone string The end bone in the IK chain. Required.
ik_end_effector_target_bone string
Blank image.pngTodo: Maybe something related to procedural targets.
rules array List of IK rules. Syntax: { { < type = "$" >, ... }, ... }
solverInfo array Solver configuration. Possible syntax: { < type = [ "perlin" / "fabrik" / "maya_two_bone" ] > }
lockInfo array Blank image.pngTodo:

Possible Syntax: { boneInfluenceDriver = "$", reverseFootLockBone = "$", lockBoneInfluenceDriver = "$", maxLockDistanceToTarget = #, hyperExtensionReleaseThreshold = #}

IK Rules

IK rules in the rules array.

Blank image.pngTodo: This list is likely incomplete.
Name Syntax Description
ground { rule = "ground", trace_diameter = #, height = # } Attempts to place the end bone on the ground.
touch { rule = "touch"}
Blank image.pngTodo: Possibly unsupported currently
procedural_target { rule = "procedural_target", name = "$", bone= "$" } Attempts to set the end bones position and orientation to values supplied by code. A VScript method for the CBaseAnimating class exists to control this.

IK Constraints

IK constraints in the constraints array.

Blank image.pngTodo: This list is likely incomplete.
Name Syntax Description
hinge { type = "hinge", joint="$", min_angle = #, max_angle = # }
Blank image.pngTodo: Adds a hinge of some kind with angle limits to the specified bone