Version: 2018.4
Constant Force
铰链关节

Fixed Joint

Fixed Joints restricts an object’s movement to be dependent upon another object. This is somewhat similar to Parenting but 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

Property: Function:
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.
Enable Collision When checked, this enables collisions between bodies connected with a joint.
Enable Preprocessing Disabling preprocessing helps to stabilize impossible-to-fulfil configurations.

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.
Constant Force
铰链关节