$controller: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
(cleanup - but I don't understand the "mouth" thing ...)
Line 1: Line 1:
{{stub}}
{{stub}}
<!-- confirm mouth = 1, confirm syntax of "tracker" -->
* The [[QC Command]] [[$controller]] allows game code to control a bone rotation.


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.
== Syntax ==


If you need a controller that rotates around more then one axis, then you need to specify a new controller for each axis.
$controller <number> "<bone_name>" <L><axis><R> <start_angle> <end_angle>
where
; <number> : The number of the controller (you may need multiple controllers). {{todo|confirm that you can also use "mouth" for <number> as it is the same as it represents the value 1, this is hard-coded in studiocompiler.}}
; <bone_name> : the name of the bone to control.
; <axis> : The axis can be either X, Y, or Z. You need to specify a new controller for each axis of rotation. 
; <L> : The prefix L on the axis specifies that this controller loops back around to the start when it ends (see example below).
; <R> : The suffix R specifies the angles are in {{wiki|radian}}s instead of degrees (see example below).
; <start_angle> : the offset start angle of the rotation in degrees (or radians).
; <end_angle> : the offset end angle of the rotation in degrees (or radians).  


== Description ==
=== Example ===
$controller number "bone-name" axis start-offset end-offset
 
== Example ==
  $modelname "npcs/robot.mdl"
  $modelname "npcs/robot.mdl"
  $cdmaterials "models/npcs/"
  $cdmaterials "models/npcs/"
  $model "Robot" "robot.smd"
  $model "Robot" "robot.smd"
  '''$controller 1 "jaw" X 0 20<!-- $controller 2 "tracker" LYR -1 1 -->'''
  '''$controller 1 "jaw" X 0 20'''
'''$controller 2 "tracker" LYR -1 1'''
  $sequence "idle" "idle.smd"
  $sequence "idle" "idle.smd"


{{todo|confirm syntax of "tracker"}}


[[Category:QC Commands]]
[[Category:QC Commands]]

Revision as of 12:31, 30 March 2008

Stub

This article or section is a stub. You can help by expanding it.

Syntax

$controller <number> "<bone_name>" <L><axis><R> <start_angle> <end_angle>

where

<number>
The number of the controller (you may need multiple controllers).
Todo: confirm that you can also use "mouth" for <number> as it is the same as it represents the value 1, this is hard-coded in studiocompiler.
<bone_name>
the name of the bone to control.
<axis>
The axis can be either X, Y, or Z. You need to specify a new controller for each axis of rotation.
<L>
The prefix L on the axis specifies that this controller loops back around to the start when it ends (see example below).
<R>
The suffix R specifies the angles are in Wikipedia icon radians instead of degrees (see example below).
<start_angle>
the offset start angle of the rotation in degrees (or radians).
<end_angle>
the offset end angle of the rotation in degrees (or radians).

Example

$modelname "npcs/robot.mdl"
$cdmaterials "models/npcs/"
$model "Robot" "robot.smd"
$controller 1 "jaw" X 0 20
$controller 2 "tracker" LYR -1 1
$sequence "idle" "idle.smd"
Todo: confirm syntax of "tracker"