Unity组件:Fixed Joint 固定关节

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学习中心查找。链接https://www.paws3d.com/learn/,也可以加入unity学习讨论群935714213

你可能感兴趣的:(unity2018)