$jigglebone

From Valve Developer Community
Jump to: navigation, search
The assumed orientation of a Jiggle Bone.

Marking bones within your model’s skeleton as "jiggle bones" 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.

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 three types of "property groups":

  • is_rigid
  • is_flexible
  • has_base_spring

Each group is optional, but is_rigid and is_flexible 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 the end of the bone, 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.
pitch_stiffness 
How stiff the spring is in the local pitch rotational axis.
pitch_damping 
Damping along the local pitch rotational axis.
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 "tip" mass is from the base in inches. Short lengths result in dramatic jiggling. Longer lengths result in more subtle motions.
tip_mass 
How much the tip 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 "tip" mass is from the base in inches. Short lengths result in dramatic jiggling. Longer lengths result in more subtle motions.
tip_mass 
How much the tip 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.
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.
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.