线缆与绳索
![Info content.png](/w/images/f/f6/Info_content.png)
This page either contains information that is only partially or incorrectly translated, or there isn't a translation yet.
If this page cannot be translated for some reason, or is left untranslated for an extended period of time after this notice is posted, the page should be requested to be deleted.
Also, please make sure the article tries to comply with the alternate languages guide.
概括性的地图制作系列 讨论你的想法——帮助我们写你需要的文章和想法 |
---|
弹药 | 生物 | 蚁狮 | 光束和激光 | 线缆和绳子 | 动态的天空与云雾 | 颜色理论 | 战斗 | 联合军 | 门 | 尘土、雾、烟 | 升降机 | 关卡转换 | 环境光效、太阳、天气、室外 | 爆炸 | 火焰 | 植被 | 玻璃和窗户 | 梯子 | 光效 | 优化 | 物理 | 视网膜扫描仪 | 声效和音乐 | 特效 | 地形 | 火车 | 机枪塔 | 水 | 僵尸 |
Cables provide a simple method for adding movement and complexity to a scene for a relatively low cost. Cables can be strung between moving objects and used as a visual representation between physical constraints (springs, length constraints, etc). Cables can also dynamically be shaken or broken by level events.
![Note.png](/w/images/thumb/c/cc/Note.png/10px-Note.png)
Placement
Cables are strewn through a level using the move_rope
and keyframe_rope
entities using the described method:
- Place a
move_rope
entity at one desired anchor point for the rope. - Place a
keyframe_rope
at the second anchor point. - Point the "Next Keyframe" field on the
move_rope
to thekeyframe_rope
entity.
You'll now see a line representing an estimation of how the cable will lie between the two points. Cloning the keyframe_rope
entity will automatically rename the new entity and point the entity that was cloned from to that new entity. Using this method you can quickly lay out cables through multiple points (like power lines).
Appearance
Cables have a certain amount of "slack", which is the amount of bend they have while resting between their two anchor points. Slack helps give the cables a greater sense of motion and believability. The value entered into the entity field dictates how much "extra" cable there is between the two anchor points. This is equivalent to stretching the cable directly between the two points, then adding the specified number of units to that length.
As the cable moves, the slack is not recalculated, so a cable that initially droops due to slack will become taut if one of the end points moves away from the other. Likewise, a taut cable will begin to droop if its end points move closer together. (NOTE: The keyframe_rope
entity includes a flag marked 'Auto Resize' which will recalculate the slack on the rope in realtime. This is extremely useful for things like a crane raising an object or a counterweighted elevator.) The line representing the estimated lie of the cable in Hammer will update itself based on the values entered, and may be used as a guide for how the cable will look when seen in the engine.
Behavior
Cable anchor points may be placed in hierarchy with other objects, and will move along with those entities. In the sample map provided in the SDK, a moving door (cleverly disguised as a pole) provides a dynamic anchor point for two cables. As the door moves, the cables stretch and move to maintain their span. In addition, a timed env_shake entity periodically moves all the anchor points, causing the cables to "bounce." These techniques can be a very effective visual tool for adding movement and polish to simple moving pieces in the world.
It is possible to detach cables from their anchor points, either by a player's direct action or by triggering it to do so. When a cable receives a "Break" input, it will detach itself from the anchor point which received the input. A cable will also detach itself from an anchor point if that point is parented via hierarchy to an entity which is killed. In the sample map provided in the SDK, add a weapon_crowbar entity to the map. The tattered pole (a func_breakable ) on the left-most side of the map can be broken with the crowbar. When the pole breaks, it triggers a "Break" output to the anchor point at its top and the cable attached to it will fall to the ground.
By default, cables are not solid and will pass through world geometry. In some cases (especially when cables are broken), this can be visually unacceptable. By using the "Collide With World" setting on the entity, the cable can be made to collide with world geometry. Because this makes the cable more expensive, this setting is only recommended for cables that exhibit the problem of penetrating the world.
Example maps
sdk_cables.vmf
TWHL example maps
See also
- Cables on Models - Cable placement on models.
phys_lengthconstraint
- entity that suspends an object with a unstretchable cable.phys_pulleyconstraint
- entity used to make a pulley.phys_spring
- entity used to make a stretchable, springy cable.- WiseWind - Wind-blown power lines
- Hanging lamps - tutorial for making a hanging lamp prop.
- Suspended Object Trap - tutorial for making a trap with an object suspended by a rope.
- Cable - Shader for cable materials.
- SplineRope - Shader for cable materials.