This article's documentation is for anything that uses the Source engine. Click here for more information.

$controller: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
(14 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{stub}}
{{tabsBar|main=gs|base=$controller}}
<!-- confirm mouth = 1, confirm syntax of "tracker" -->
{{this is a|QC command|name=$controller}} It creates a channel to manually set a single axis position or angle on a bone through game code. Not recommended for use, as this functionality was succeeded by [[$poseparameter]] and [[$sequence]].


Allows the bone to be controlled from game code. <!-- Although "mouth" can be used in place of a number it is the same as just using the number 1, this is hard-coded in studiocompiler. -->The axis can be X, Y, or Z. The prefix L on the axis specifies that this controller loops back around to the start when it ends. The suffix R specifies the angles are in {{wiki|radian}}s instead of degrees.
{{Warning|You can't assign more than 6 controllers to a single bone.}}


If you need a controller that rotates around more then one axis, then you need to specify a new controller for each axis.
== Syntax ==
$controller <number> "<bone_name>" [L]<axis>[R] <start> <end>
 
where
; <number> : The number of the controller (you may need multiple controllers). 0-3 for custom controller, 4 or "mouth" for jaw (GoldSrc only).
; <bone_name> : The name of the bone to control.
; <L> : The prefix 'L' specifies that the controller is to loop the bone movement from the <end> to the <start>. {{Warning|GoldSrc only.}}
; <axis> : The axis can be either X, Y, or Z. You need to specify a new controller for each axis of movement/rotation. 
; [R] : The suffix 'R' specifies that the bone is to be rotated from <start> {{wiki|degrees}} to <end> {{wiki|degrees}}. Not including 'R' simply moves the bone along the <axis> from <start> world [[unit]]s to <end> world [[unit]]s.
; <start> : Starting value of the controller.
; <end> : End value of the controller.


== Description ==
$controller number "bone-name" axis start-offset end-offset


== Example ==
== Example ==
  $modelname "npcs/robot.mdl"
  $modelname "WScanner_Single.mdl"
  $cdmaterials "models/npcs/"
$model "WScanner" "WScanner_Single_Waste_Scanner_Reference.smd"
  $model "Robot" "robot.smd"
  $cdmaterials "models\obsolete\waste_scanner\"
  '''$controller 1 "jaw" X 0 20<!-- $controller 2 "tracker" LYR -1 1 -->'''
//This controller rotates the root bone from 0 to 360 degrees.
$sequence "idle" "idle.smd"
  '''$controller 0 "Dummy (Root)" ZR 0 360'''
 
//Controller 1 has two entries to allow for the bone to travel 17 units in the X(-Z) direction.
 
//$controller lines can only have one direction specified, so this allows for blending the movement.
[[Category:QC Commands]]
//move the antenna base bone from 0 to 17 units in the X direction.
  '''$controller 1 "Antenna Base" X 0 17'''
//move the antenna base bone from 0 to -17 units in the Z direction.
'''$controller 1 "Antenna Base" Z 0 -17'''

Latest revision as of 21:27, 16 July 2025

$controller is a QC command available in all Source Source games. It creates a channel to manually set a single axis position or angle on a bone through game code. Not recommended for use, as this functionality was succeeded by $poseparameter and $sequence.

Warning.pngWarning:You can't assign more than 6 controllers to a single bone.

Syntax

$controller <number> "<bone_name>" [L]<axis>[R] <start> <end>

where

<number>
The number of the controller (you may need multiple controllers). 0-3 for custom controller, 4 or "mouth" for jaw (GoldSrc only).
<bone_name>
The name of the bone to control.
<L>
The prefix 'L' specifies that the controller is to loop the bone movement from the <end> to the <start>.
Warning.pngWarning:GoldSrc only.
<axis>
The axis can be either X, Y, or Z. You need to specify a new controller for each axis of movement/rotation.
[R]
The suffix 'R' specifies that the bone is to be rotated from <start> Wikipedia icon degrees to <end> Wikipedia icon degrees. Not including 'R' simply moves the bone along the <axis> from <start> world units to <end> world units.
<start>
Starting value of the controller.
<end>
End value of the controller.


Example

$modelname "WScanner_Single.mdl"
$model "WScanner" "WScanner_Single_Waste_Scanner_Reference.smd"
$cdmaterials "models\obsolete\waste_scanner\"
//This controller rotates the root bone from 0 to 360 degrees.
$controller 0 "Dummy (Root)" ZR 0 360
//Controller 1 has two entries to allow for the bone to travel 17 units in the X(-Z) direction.
//$controller lines can only have one direction specified, so this allows for blending the movement.
//move the antenna base bone from 0 to 17 units in the X direction.
$controller 1 "Antenna Base" X 0 17
//move the antenna base bone from 0 to -17 units in the Z direction.
$controller 1 "Antenna Base" Z 0 -17