人物相關的物理系統組件詳述

繼續上一篇對物理系統的概述。本篇主要學習和物理系統相關聯的一些組件。這裏略去了一些無聊的碰撞體,直接從一些平時注意不到但是很有意思的組件開始。
首先介紹一個基礎概念:力矩在物理學裏是指作用力使物體繞着轉動軸或支點轉動的趨向。
(1)Character Joint
Character Joints are mainly used for Ragdoll effects. They are an extended ball-socket joint which allows you to limit the joint on each axis.
角色關節在布娃娃系統當中應用。主要就是根據骨骼將整個人物的碰撞體以及骨骼之間限制角度等等調整好,從而在沒有動作的情況下,模擬出真實的人物死亡或者炸飛的效果。
該控件的幾個重要屬性:
The point in the GameObject’s local space where the joint rotates around.
Anchor:錨點,整個繞着該錨點進行旋轉。注意這是局部座標系。

Auto Configure Connected Anchor:自動設置鏈接錨點的Flag。如果設置爲true,那麼鏈接錨點(Connected Anchor)會自動進行計算。

Connected Anchor:Manual configuration of the connected anchor position.
這個是手動調整錨點的位置。這個相對於錨點,是全局座標。調整位置可以讓骨骼更自然。比如slenderman的遊戲角色。

The Swing 1 Limit: limits the rotation around the swing axis (visualized with the green axis on the gizmo). The limit angle is symmetric. Thus a value of 30 will limit the rotation between –30 and 30.
限制圍繞擺動軸(swing axis)的旋轉。限制角度是對稱的。

The Swing 2 Limit: axis isn’t visualized on the gizmo but the axis is orthogonal to the two other axes (that is the twist axis visualised in orange on the gizmo and the Swing 1 Limit visualised in green on the gizmo). The angle is symmetric, thus a value of 40 will limit the rotation around that axis between –40 and 40 degrees.
在Gizmo上軸不可視化,但軸與其他兩個軸正交。該角度是對稱的,因此值40將限制該軸在-40度和40度之間的旋轉。

Low Twist Limit :限制關節的下限。

High Twist Limit:限制關節的上限。

Break Force :The force that needs to be applied for this joint to break.
關節脫落所需要的力,如果要做斷肢的效果,必不可少。

Break Torque:The torque that needs to be applied for this joint to break.
關節脫落所需要的力矩。
以上兩個屬性一旦滿足,當前骨骼不受到character joint的影響。

Enable Collision:When checked, this enables collisions between bodies connected with a joint.
是否開啓碰撞。當該Flag爲True的時候,同一個身體之間的碰撞體會互相作用。

注意在上述部分屬性當中還有一些子屬性:
Bounciness: A value of 0 will not bounce. A value of 1 will bounce without any loss of energy.
反彈力。value爲1的值會不收任何能量損失的反彈。
Spring: The spring force used to keep the two objects together.
彈簧力。當兩物體相作用的時候會體現。
Damper: The damper force used to dampen the spring force.
阻尼:使用阻尼來阻礙彈簧力。
Contact Distance Within the contact distance from the limit contacts will persist in order to avoid jitter.
恆定力:在constact distance屬性範圍內都會持續,這將避免抖動。

布娃娃系統
在瞭解以上的功能基礎上,我們來了解布娃娃系統。基於character joint的自動生成系統。
GameObject > 3D Object > Ragdoll就可以打開布娃娃系統製作。
將你的模型拖到視圖當中之後,將其骨骼拖入到對應布娃娃系統面板的對應位置,點擊create,你就會發現你的模型相應的骨骼都已經創建好了相應的剛體、碰撞體和角色關節。
你可能會疑惑創造一個跟玩偶一樣的東西有屁用。下面我說幾個例子:
死亡空間2 其中抖動的變異體大家如果玩過一定印象深刻。調整他的 archor故意讓其抖動。
上古卷軸5 當主角被巨人一棒子打飛的時候,角色處於骨骼的隨機狀態。來模擬非常真實的被擊飛效果。
軒轅劍 其中角色的死亡動畫就是用布娃娃系統製作。通過布娃娃系統,我們可以模擬真實的角色受力形態,而不是僅僅播放死亡動畫。

(2)Constant Force 恆定力
Constant Force is a quick utility for adding constant forces to a Rigidbody. This works great for one shot objects like rockets, if you don’t want it to start with a large velocity but instead accelerate.
恆定力是通過針對剛體進行力的增加的一個非常優秀的組件。
例如模擬火箭的升空。很多小遊戲可以通過這個組件模擬出真實的物理特效。
下面介紹該組件相關的屬性:
Force:The vector of a force to be applied in world space.
應用於世界座標系當中的力。
Relative Force The vector of a force to be applied in the object’s local space.
應用於局部座標系的力。
Torque The vector of a torque, applied in world space. The object will begin spinning around this vector. The longer the vector is, the faster the rotation.
力矩:這個力矩應用於世界座標系。根據不同的軸進行旋轉。長度越長轉的越快。
Relative Torque The vector of a torque, applied in local space. The object will begin spinning around this vector. The longer the vector is, the faster the rotation.
相對力矩:這個力矩相對於局部座標系。

(2)布料系統 Cloth
The Cloth component provides a physics-based solution for the simulation of fabrics and works in conjunction with the Skinned Mesh Renderer. While it has been specifically designed for character clothing it is still possible to use arbitrary, non-skinned meshes.
布料組件應用於基於物理的纖維模擬,當然需要配合Skinned Mesh Render組件的配合。尤其是針對Character進行設計的衣服。當然也可以爲非角色的object使用。

Stretching Stiffness:Stretching stiffness of the cloth.
拉伸剛度:衣服的拉伸剛度。
Bending Stiffness Bending stiffness of the cloth.
彎曲剛度:衣服的彎曲剛度。
Use Tethers Apply constraints that help to prevent the moving cloth particles from going too far away from the fixed ones. This helps to reduce excess stretchiness.
使用

Use Gravity :Should gravitational acceleration be applied to the cloth?
使用重力:讓衣服具有重力質感。
Damping:Motion damping coefficient.
阻尼運動。
External Acceleration:A constant, external acceleration applied to the cloth.
額外的加速度:施加到衣服上的額外加速度。比如風吹的效果。
Random Acceleration:A random, external acceleration applied to the cloth.
隨機的加速度:施加到衣服上隨機的加速度。
World Velocity Scale How much world-space movement of the character will affect cloth vertices.
世界速度Scale:人物的移動會作用於角色上。
World Acceleration Scale How much world-space acceleration of the character will affect cloth vertices.
世界加速度Scale:世界的加速度會作用於衣服上。
Friction The friction of the cloth when colliding with the character.
與人物碰撞時,布料的摩擦力。
Collision Mass Scale How much to increase mass of colliding particles.
碰撞質量。
Use Continuous Collision Enable continuous collision to improve collision stability.
多次碰撞:通過多次碰撞來增加碰撞穩定性。
Use Virtual Particles Add one virtual particle per triangle to improve collision stability.
使用虛擬粒子:每一個三角形都設置一個虛擬粒子,來提升碰撞穩定性。
Solver Frequency Number of solver iterations per second.
解釋器速度:每秒所需要解釋的次數。這裏理解爲計算的次數吧。
Sleep Threshold Cloth’s sleep threshold.
睡眠閾值。
Capsule Colliders An array of CapsuleColliders which this Cloth instance should collide with.
膠囊碰撞體:衣服所作用於的膠囊碰撞體。
Sphere Colliders An array of ClothSphereColliderPairs which this Cloth instance should collide with.
球狀碰撞體:大體如上。

Edit Constraints Tool 編輯約束模式
Selecting Edit Constraints will enter the editor into a mode to edit the constraints applied to each of the vertices in the cloth mesh. All vertices will be coloured based on the current Visualization mode to display the difference between their respective values.
在Cloth組件下可以進入編輯約束模式,從而編輯應用到每一個衣服的點的狀況。可以在可視化情況下對每個點進行顏色修改,從而影響不同點之間的作用情況。

Property: Function:
Visualization Changes the visual appearance of the tool in the Scene view between Max Distance and Surface Penetration Values. A toggle for Manipulate Backfaces is also available.
可以在最大距離和表面滲透之間的場景當中更改工具的視覺外觀。
Max Distance The maximum distance a cloth particle can travel from its vertex position.
最大距離:衣服粒子距離其頂點位置的最遠距離。
Surface Penetration How deep the cloth particle can penetrate the mesh.
表面滲透:布粒子可以穿透網格有多深。
關於編輯器的使用有兩種方式:
There are two modes that can be used for changing the values for each vertex, in Select mode a group of vertices can be selected using the mouse cursor to either draw a selection box or else by individually clicking on vertices one at a time. Once any number of cloth vertices have been selected they can then have either Max Distance or Surface Penetration constraints enabled and a value assigned.
一種select方式,就像玩RTS一樣拖出一堆粒子,之後可以就可以對其的最大距離和表面滲透進行修改。
Paint mode allows you to directly adjust each individual vertex by clicking on it, again with options to adjust the Max Distance, Surface Penetration, or both. As before a value can be assigned and the visual representation in the scene view will be updated.
另外一種是繪製模式,發揮你的藝術天分吧。

Cloth is unable to simply collide with arbitrary world geometry, and now will only interact with the colliders specified in either the Capsule Colliders or Sphere Colliders arrays.
衣服組件是對世界當中的碰撞和幾何體無效的。並且不可以被除了膠囊和球碰撞體所影響。

The sphere colliders array can contain either a single valid SphereCollider instance (with the second one being null), or a pair. In the former cases the ClothSphereColliderPair just represents a single sphere collider for the cloth to collide against. In the latter case, it represents a conic capsule shape defined by the two spheres, and the cone connecting the two. Conic capsule shapes are useful for modelling limbs of a character.
球體球體碰撞體數組可以包含單個球體碰撞體實例。只需要將對應的膠囊體和球體放到對應的list當中就會對布料有所影響。
這裏的名詞:ClothSphereColliderPair 更多的是一種類似於錐形的膠囊體。用於模擬肢體。

下面附上我的一個小例子:
這裏寫圖片描述

正如上圖所示,我對小姐姐的骨骼碰撞體並沒有仔細的調整。大體添加了五個膠囊碰撞體。小姐姐的衣服會根據小姐姐的動作做出非常逼真的物理動作…當然如果你把小姐姐的衣服的點都繪製成綠色(max distance很大)就會出現爆衣特效…爲了和諧,這裏不放圖了。大家可以上網找一些素材試試。蠻有意思的組件。有哪些地方有問題歡迎大家及時提出。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章