Cables on Models
Cables can be placed onto models simply by placing the correct code into the QC file. The cables work in the same fashion as the ones created using the move_rope
and keyframe_rope
entities, only that they're more limited in that they can't be broken or made solid. A good example of this is the model of Dog from HL2.
Note:If used on props, the prop entity must be set as
prop_dynamic
for the cables to be rendered.Warning:Does not work in Left 4 Dead 2
Workaround:Add
move_rope
and keyframe_rope
entities like any other rope. Then use a logic_auto
to parent each end to the model via SetParentAttachment
.Bug:Ropes doesn't disappear with prop fade out. [todo tested in?]
Adding cables to a model
Cables are added to a model first by defining $attachment points.
$attachment "point1" "staticprop" 0.00 0.00 9.50 rotate 0.00 0.00 0.00 $attachment "point2" "staticprop" -128.00 0.00 9.50 rotate 0.00 0.00 0.00 $attachment "point3" "staticprop" 0.00 0.00 25.50 rotate 0.00 0.00 0.00
The code to create the cables must be placed within the $keyvalues block in another block titled Cables. Every time you want to create a single cable you must create a block titled "Cable"
- StartAttachment <attachment name>
- The $attachment point the cable starts from.
- EndAttachment <attachment name>
- The $attachment point the cable ends to.
- Width <float>
- Defines the width of the cable.
- Material <VMT file location>
- The VMT (material) to use. Cable materials are located in "materials/cables".
- NumSegments <int>
- The amount of segments in the cable. More segments make the cable more 'smooth'. Should be increased if the cable bends a lot.
- Length <int>
- The length of cable between the two attachment points. If the length is shorter than the distance between the two points then the cable will remain permanently straight.
- Note:Finding the optimal length between two points can be a frustrating task. Cables can go from super tight to extremely slack within a difference of just 10 units.
Example
In this example, two cables are create between the three attachment points.
$keyvalues { Cables { "Cable" { "StartAttachment" "point1" "EndAttachment" "point2" "Width" "0.6" "Material" "cable\cable" "NumSegments" "4" "Length" "200" } "Cable" { "StartAttachment" "point2" "EndAttachment" "point3" "Width" "0.6" "Material" "cable\cable" "NumSegments" "6" "Length" "250" } } }