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.
Property: | Function: |
---|---|
Connected Body | Optional reference to the Rigidbody that the jointA physics component allowing a dynamic connection between Rigidbody components, usually allowing some degree of movement such as a hinge. More info See in Glossary 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 collisionsA collision occurs when the physics engine detects that the colliders of two GameObjects make contact or overlap, when at least one has a Rigidbody component and is in motion. More info See in Glossary between bodies connected with a joint. |
Enable Preprocessing | Disabling preprocessing helps to stabilize impossible-to-fulfil configurations. |
There may be scenarios in your game where you want objects to stick together permanently or temporarily. Fixed Joints may be a good ComponentA functional part of a GameObject. A GameObject can contain any number of components. Unity has many built-in components, and you can create your own by writing scripts that inherit from MonoBehaviour. More info
See in Glossary 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 RigidbodiesA component that allows a GameObject to be affected by simulated gravity and other forces. More info
See in Glossary 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.
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.