物理实体概述

From Valve Developer Community
Jump to: navigation, search
English (en)中文 (zh)
... Icon-Important.png
Info content.png
This page has not been fully translated.

You can help by finishing the translation.

Also, please make sure the article tries to comply with the alternate languages guide.

为起源引擎添加物理打开了更为广阔的模拟可能性。

从摇摆的轮胎到约束机械结构, 设计者现在能够创作出物理上以现实方式工作的机械和物体。

去制作这些物体, 必须用多个物理实体来描述实体们怎么被物理上地约束或者与其中另一个所关联。 这里我们列出了这些实体和他们的作用。

(枢: 门的轴,一般门缝间的小铁片,也叫合页,铰链)

约束

现实中, 物体(objects)以各种手段被 约束(constrained) 在一起。 门通过枢附在门框上通过悬挂可以摆动。 你的胳膊附在你的躯干上通过一个球形关节。 重物可以移动通过绳索和滑轮系统。 这些概念在起源引擎的物理执行中被完整地模拟出来。

以下是一个你能够用来将一个实体依附在另一个上的各种约束系统列表。

phys_constraintsystem
如果你有一组物件被约束连接在一起, 那约束求解器可能会互相打起来,因为他们都在本地求解(不考虑其他约束的话)。 这可以引起一个约束系统的不稳定, 你将会看到类似于抽搐或抖动。 为了防止这个问题, 你可以为每一组连接的约束使用一个 phys_constraintsystem ,并且让其作为该组的系统管理员。 当你这么做了, 这些求解器将作为一个组进行迭代, 这将在约束们之间制造一个反馈循环,使他们之间的交互便能够进行管理。 约束系统(The constraint system) 也允许你控制迭代的次数 - 这使你能够消耗更多的cpu来更紧凑的求解。 大体上这里的问题是被约束连起来的物体质量不同的结果。 如果一个大块儿物体在一个违反约束的位置, 它则需要为其付出更多的迭代来移动到一个不违反的位置/方向。 值得注意的是所有的布娃娃(ragdolls)都在内部制作了一个约束系统来解决此类问题。

(迭代:计算机重复执行一组指令)

(布娃娃:通过物理引擎实现的一种动作很夸张的模型,类似于 "人类一败涂地 ")

phys_constraint
现有的最简单的约束, 这个约束只是将一个附在另一个上, 像是被刚性约束所固定一般比如钉子或胶水。 此实体为两个实体(目标)定义了两个字段来约束。 如果任一实体留空,(另一个)所提供的实体会死死的约束在原点。 最经常用这个将对象约束到世界。 像所有的约束一样, 你还可以指定一个力或者扭矩限制 - 约束何时被 "打破"。 当足够的力量或者扭矩被施加到附在约束上的对象身上则会打破, 导致约束禁用自身然后产出一个可以用来编排其他事件的输出。

See mapssdk_phys_constraint.vmf

phys_ballsocket
一个球窩/球形关节(ball socket)约束等同于你的手臂如何在你的肩膀处连结你的躯干。 一个物体固定在另一个对象的一个点上并且能够转动,然后围绕那个点做球面运动。 这也可以用来表达游戏中一条绳索和一部分世界结构的连接。 绳索在世界中的那个点将能够转动一个球形的范围。

See mapssdk_phys_ballsocket.vmf

phys_hinge
像门枢一样, 这个约束允许被约束的物体围绕一个运动轴旋转。 枢(hinge)的轴通过Hammer中的辅助工具表示。 这个枢能够给定一个摩擦组成(friction component), 可以使其更快的停靠大概像一个老门枢那样。 "load scale" 字段与 phys_motor 的实现一致。

(辅助工具/视觉辅助:创建时在点实体中心可以拖动的一个小圆圈,拖动后与点实体中心形成轴)

See mapssdk_phys_hinge.vmf

phys_lengthconstraint
这是一个在两个实体之间保持距离的约束。 如果 "保持刚性(Keep Rigid)" 标志被选中, 他可以被看做是一根竿子。 如果没有, 他将表现的像一个无形的绳索 (with some amount of "give")。

See mapssdk_phys_lengthconstraint.vmf

phys_pulleyconstraint
本质上, 这个约束其实是两个长度约束和空间中的两个点。 它类似于连接两个物体的虚拟绳索, 每个都悬挂在上方的滑轮上。 约束使得滑轮点和它们悬挂的物体之间的距离总和保持不变。 换句话说, 移动一个被约束的对象会使得另一个对象也移动来保持“绳索”的长度不变。

See mapssdk_phys_pulleyconstraint.vmf

phys_convert
phys_convert 应当用于将固体或模型的行为转化为。 打个比方, 假如说你做了一个 func_tracktrain 并带有一些 prop_dynamic 实体作为子项。 For a while you use Entity I/O to move the tracktrain and its children along some path, then at some event you want the train to explode and become physically simulated to tumble. You can use a phys_convert to convert the tracktrain and the dynamic props into physics objects at the time of that event (since func_tracktrain and prop_dynamic do not have the desired physics behavior built in).

See mapssdk_phys_convert.vmf

phys_ragdollconstraint
类似于一个普通的 phys_constraint 实体但是用于将布娃娃拴在空间的某个位置,这个约束也允许用户去控制每个轴的移动量,以及每个轴上施加多少摩擦力。

See mapssdk_phys_ragdollconstraint.vmf

phys_slideconstraint
这个约束允许沿着一个轴移动。 你可以将其看作浴帘环沿着浴帘竿滑动。 类似于枢约束(hinge constraints),实体为指定的行进方向提供了视觉辅助。

See mapssdk_phys_slideconstraint.vmf

phys_keepupright
Some objects need to attempt to remain upright. This constraint applies torque to a physics object to attempt to do just that. The number of degrees of angular torque that can be applied per second is specified in the "Angular Limit" field of the entity. The higher the number, the more rigidly the object will maintain its upright positioning.

See mapssdk_phys_keepupright.vmf

phys_spring
This is a physically simulated spring. The "Length" field specifies what is known as the natural spring length. This is how long the spring would be if it was at rest (nothing hanging on it or attached). When you attach something to the spring, it will stretch longer than its natural length. The amount of stretch is determined by the "Sprint Constant" field. The larger the spring constant, the less stretch the spring will accommodate.

See mapssdk_phys_sprint.vmf

杂项

phys_magnet
一个像磁铁一样的实体, 当金属物理对象接触他们时,会把对象附在自己身上。

See mapssdk_phys_magnet.vmf

phys_motor
An entity that tries to spin a target entity at a particular speed. This can be thought of as a motor with an axle connecting directly to an object. Connected to a tire, it could make it spin much like a car's tire. There is also a "load scale" field which works similarly to horsepower. The motor will attempt to move an object at a given velocity, but if that object creates resistance (from a collision, for instance), the motor will use the load scale field to increase its output to continue and move the object at the correct speed. A value of "2" would make the motor exert twice as much force as it normal would need to in order to move the attached object, should it meet with resistance.

See mapssdk_phys_motor.vmf

phys_ragdollmagnet
A simple entity that attracts ragdolls towards it. This is often useful for getting a more reliably dramatic death from a corpse. The entity can attract at a point, or as a "bar", meaning the entity is pulled towards that axis but not directly at a point in space. This is useful for pulling a ragdoll towards a railing's edge at any point along that edge, while not pulling it towards a specific point.

See mapssdk_phys_ragdollmagnet.vmf

phys_thruster
This entity applies force to an entity along a specified axis. This is directly analogous to a rocket's engines propelling it forward. The entity also has a built-in timing feature which allows the designer to specify a duration for the thruster to propel its target, then stop.

See mapssdk_phys_thruster.vmf

phys_torque
Like the phys_motor entity, this entity applies angular velocity to an object. This entity also has the ability to ignore the mass of the object being turned, as well as having a built in timer which allows the entity to exert torque on the attached entity for a given amount of time, disabling itself afterwards.

See mapssdk_phys_torque.vmf