Unity元件:FixedJoint固定關節

1405048499729402發表於2019-02-13

Fixed Joints restricts an object`s movement to be dependent upon another object. This is somewhat similar to Parentingbut is implemented through physics rather than Transform hierarchy. The best scenarios for using them are when you have objects that you want to easily break apart from each other, or connect two object`s movement without parenting.

固定關節基於另一個物體來限制一個物體的運動。效果類似於父子關係,但是不是通過層級變換,而是通過物理實現的。使用它的最佳情境是當你有一些想要輕易分開的物體,或想讓兩個沒有父子關係的物體一起運動。

Properties 屬性

Connected Body
連線的剛體
Optional reference to the Rigidbody that the joint is dependent upon. If not set, the joint connects to the world.
連線的剛體。一個關節連線的剛體引用,可選。如果沒有設定,那麼關節將和世界相連。
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.
斷裂的扭矩。破壞關節的扭力的大小。
Details 細節

There may be scenarios in your game where you want objects to stick together permanently or temporarily. Fixed Joints may be a good Component to use for these scenarios, since you will not have to script a change in your object`s hierarchy to achieve the desired effect. The trade-off is that you must use Rigidbodies for any objects that use a Fixed Joint.

在遊戲中肯定存在這樣的情境,你想要物體永久或暫時的粘在一起。固定關節就是一個適用於這類情況的元件,它不需要用指令碼來改變你的物體的層級來實現目標效果。但僅適用含有剛體的物體。

For example, if you want to use a “sticky grenade”, you can write a script that will detect collision with another Rigidbody (like an enemy), and then create a Fixed Joint that will attach itself to that Rigidbody. Then as the enemy moves around, the joint will keep the grenade stuck to them.

例如,你想搞個粘性炸彈,你就可以寫個指令碼來檢測物體與其他剛體(比如敵人)的碰撞,然後建立一個固定關節將自身與該剛體相連。那麼當敵人移動時,關節就會使導彈一直粘在他身上。

Breaking joints 斷開關節

You can use the Break Force and Break Torque properties to set limits for the joint`s strength. If these are less than infinity, and a force/torque greater than these limits are applied to the object, its Fixed Joint will be destroyed and will no longer be confined by its restraints.

你可以使用破壞力與破壞扭力屬性來設定關節強度的極限。如果這些引數小於無窮大,而施加到物體上的力或力矩大於這個限制,那麼固定關節將被銷燬,它對物體的約束也就不存在了。

Hints 提示

You do not need to assign a Connected Body to your joint for it to work.
關節並不需要設定一個連線的剛體。
Fixed Joints require a Rigidbody.
使用固定關節自身要有個剛體元件。

更多unity2018的功能介紹請到paws3d學習中心查詢。


相關文章