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

$jigglebone

From Valve Developer Community
(Redirected from Jigglebone)
Jump to: navigation, search
English (en)Español (es)Translate (Translate)

$jigglebone is a QC command available in all Source Source games since Source 2007 Source 2007. It marks bones within your model’s skeleton as "jiggle bones" and tells the game engine to dynamically simulate them during runtime, allowing for realistic secondary motions such as wiggling antennas, bouncy flesh, floppy ears, and so on.

Warning.pngWarning:The simulated tip of jiggle bones extends in the +Z axis of the bone, bones intended to be jiggle bones should always be orientated to account for this fact when creating them in the model editor.
The assumed orientation of a Jiggle Bone.


Tutorial

A tutorial for adding jigglebones can be found here.

Another tutorial for adding jigglebones can be found here.

For Blender users, a tutorial can be located here.

Syntax

$jigglebone <name> {
	<property group> {
		<property> <value> [<value>]
		...
	}
}

Where <name> is the name of the joint tip.

There are currently four types of "property groups":

  • is_rigid
  • is_flexible
  • has_base_spring
  • is_boing (only in Source 2013)

Each group is optional, but is_rigid and is_flexible cannot be used together. has_base_spring and is_boing also cannot be used together.

Examples

Here are a few examples:

$jigglebone "Floppy" {
	is_rigid {
		tip_mass 100
		length 20
		angle_constraint 60 
	}
}
$jigglebone "JigglyUpAndDown" {
	is_flexible {
		yaw_stiffness 100
		yaw_damping 3
		length 20
		yaw_constraint 0 0
	}
}
$jigglebone "Bouncy" {
	has_base_spring {
		stiffness 100 
		damping 1 
		left_constraint -20 20
		up_constraint -20 20
		forward_constraint -20 20
	}
}
$jigglebone "FloppyAndBouncy" {
	is_rigid {
		tip_mass 100
		length 20
		angle_constraint 60 
	}

	has_base_spring {
		stiffness 100 
		damping 1 
		left_constraint -20 20
		up_constraint -20 20
		forward_constraint -20 20
	}
}

From the Antlion Worker:

$jigglebone "Antlion.glasswingR_bone" {
	is_flexible {
		yaw_stiffness 700
		yaw_damping 6
		pitch_stiffness 700
		pitch_damping 8
		tip_mass 5
		length 30
		angle_constraint 37
	}
}

Springs

Springs are simulated by specifying stiffness and damping values. Stiffness determines how stiff the spring is. A low value such as 10 is very loose and weak, whereas a value of 500 is very stiff and springy. Legal values range from 1 to 1000.

Damping is a kind of spring friction or resistance. A value of zero means the spring will oscillate forever. A damping of 10 causes the spring to stop vibrating almost immediately. Legal values range from 0 to 10.

is_flexible

If a Jiggle Bone is "flexible", a simulated mass is placed at a set distance to the bone in the +Z axis, and the bone acts like a springy, flexible rod. This spring creates rotational motion only, with the center of rotation at the base of the Jiggle Bone.

yaw_stiffness 
How stiff the spring is in the local yaw rotational axis.
yaw_damping 
Damping along the local yaw rotational axis. Small values result in dramatic jiggling. Larger values result in more subtle motions.
pitch_stiffness 
How stiff the spring is in the local pitch rotational axis.
pitch_damping 
Damping along the local pitch rotational axis. Small values result in dramatic jiggling. Larger values result in more subtle motions.
along_stiffness 
How stiff the spring is along the axis of the spring. This is only used if "allow_length_flex" is specified for this bone.
along_damping 
Damping along the axis of the spring. This is only used if "allow_length_flex" is specified for this bone.
allow_length_flex 
Normally, jiggle bones keep their length rigid. Specifying this allows that length to flex as well.
length 
How far the simulated mass is from the base in inches. This value should match the length of the bone; values larger than the bone length can result in odd and unpredictable movement in the jiggle bone if you don't know what you're doing.
tip_mass 
How much the simulated mass is affected by gravity. Zero disables gravity effects, whereas 1000 would be a heavy mass.

is_rigid

If a Jiggle Bone is "rigid", a simulated mass is placed at the end of the bone, and the bone acts like a rigid stick. This spring creates rotational motion only, with the center of rotation at the base of the Jiggle Bone.

length 
How far the simulated mass is from the base in inches. This value should match the length of the bone; values larger than the bone length can result in odd and unpredictable movement in the jiggle bone if you don't know what you're doing.
tip_mass 
How much the simulated mass is affected by gravity. Zero disables gravity effects, whereas 1000 would be a heavy mass.

Angular constraints

The following parameters can be used within either is_rigid (rigid) or is_flexible (flexible) parameter groups. Note that none or all of these constraints can be used, and that each constraint incurs nontrivial computations.

angle_constraint 
Specify the maximum angular deflection allowed, creating a conical boundary the jiggle bone cannot penetrate.
yaw_constraint (min max) 
Specify the minimum and maximum angular deflection allowed along the local yaw rotational axis. Angular values should not exceed +/- 90 degrees.
Note.pngNote:When using "yaw_constraint", setting angular values greater than or equal to +/- 90 degrees causes unwanted flipping of jiggle bone. To avoid this, rotate jigglebone such that "pitch_constraint" can be used instead.
Todo: Check to see if this applies to other property groups other than "is_rigid"
yaw_friction 
Nonzero values create frictional forces when the jiggle bone is sliding against the plane defined by the yaw limit. Friction should not exceed 20 units.
pitch_constraint 
Specify the minimum and maximum angular deflection allowed along the local pitch rotational axis. Angular values should not exceed +/- 90 degrees.
Todo: Check to see if angle constraint rule for "pitch_constraint" applies to other property groups except "is_rigid"
pitch_friction 
Nonzero values create frictional forces when the jiggle bone is sliding against the plane defined by the pitch limit. Friction should not exceed 20 units.

has_base_spring

If a Jiggle Bone has a "base spring", a simulated mass is placed on the base of the bone. This spring creates translational motion only, moving the whole Jiggle Bone in X, Y, and Z.

stiffness 
How stiff the base spring is.
damping 
The damping of the base spring.
left_constraint 
The maximum amount the bone is allowed to move along the local X axis.
left_friction 
The amount of friction applied in the up/forward plane when the spring is rubbing against the left constraint.
up_constraint 
The maximum amount the bone is allowed to move along the local Y axis.
up_friction 
The amount of friction applied in the left/forward plane when the spring is rubbing against the up constraint.
forward_constraint 
The maximum amount the bone is allowed to move along the local Z axis.
forward_friction 
The amount of friction applied in the left/up plane when the spring is rubbing against the forward constraint.
base_mass 
How much the base spring is affected by gravity.

is_boing

Todo: Documentation

Simple squash and stretch sinusoid "boing." Scales the affected bone.

impact_speed 
impact_angle 
Angle to apply when bone is at limit.
damping_rate 
Damping rate. Lower values mean the bone will animate for longer. If set to zero, the bone won't stop animating.
frequency 
How frequently to animate the bone when velocity is applied.
amplitude 
Scale factor to apply when bone is at limit.