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.

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学习中心查找。

相关文章
|
9天前
|
图形学
【unity小技巧】Unity人物衣服布料系统的探究 —— Cloth组件
【unity小技巧】Unity人物衣服布料系统的探究 —— Cloth组件
6 0
|
10天前
|
定位技术 图形学
【Unity实战】零代码实现物理2d绳子和绳桥效果——Hinge Joint 2D的使用
【Unity实战】零代码实现物理2d绳子和绳桥效果——Hinge Joint 2D的使用
6 0
|
10天前
|
开发工具 图形学
【推荐100个unity插件之11】Shader实现UGUI的特效——UIEffect为 Unity UI 提供视觉效果组件
【推荐100个unity插件之11】Shader实现UGUI的特效——UIEffect为 Unity UI 提供视觉效果组件
9 0
|
2月前
|
编解码 前端开发 人机交互
【Unity 3D】UI系统中UGUI各个组件的详细讲解(附源码 超详细)
【Unity 3D】UI系统中UGUI各个组件的详细讲解(附源码 超详细)
123 0
|
2月前
|
C# 图形学
【Unity 3D】游戏对象、添加删除获取组件、预制体Prefabs简介
【Unity 3D】游戏对象、添加删除获取组件、预制体Prefabs简介
128 0
|
7月前
|
编译器 图形学
Unity用脚本获取物体和组件(下)
Unity用脚本获取物体和组件(下)
133 0
|
7月前
|
图形学
Unity 用脚本获取物体和组件(上)
Unity 用脚本获取物体和组件(上)
187 0
|
7月前
|
图形学
Unity常用组件
Unity常用组件
147 0
|
8月前
|
前端开发 C# 开发工具
Unity快手上手【熟悉unity编辑器,C#脚本控制组件一些属性之类的】
Unity快手上手【熟悉unity编辑器,C#脚本控制组件一些属性之类的】
125 0
|
10月前
|
图形学