Physics Joint
This section describes the specifications for exporting Physics Joints in Unity to USD.
What is a Physics Joint?
Types of physics joint supported for export
Physics Joint export from Unity to USD supports the following.
Unity |
USD |
Description |
---|---|---|
FixedJoint |
FixedJoint |
Fixed connection of two shapes |
HingeJoint |
RevoluteJoint |
Rotate around 1 axis |
SpringJoint |
DistanceJoint |
Spring movement |
ConfigurableJoint |
D6Joint |
Free rotation used for character articulation.In addition, spring effects can be added for each XYZ axis. |
CharacterJoint |
D6Joint |
Free rotation used for character articulation |
FixedJoint
RevoluteJoint
SphericalJoint
D6Joint
DistanceJoint
Specifying Physics Joint in Unity
There are several rules for specifying Physics Joints in Unity.
Shapes participating in Physics Joint should be assigned a Rigidbody.
Rigidbody is added by a component.
By setting IsKinematic to On, the shape can be made to follow the transform operation at runtime.
The Physics Joint connects two shapes.
Add Physics Joint as a component of the shape of the connection source and specify the connection destination in its parameters.
Limitations to align specifications with USD side
In USD, when Rigidbody is nested, the behavior is different from Unity.
Note
DO NOT structure the Rigidbody within the Rigidbody shape because this will not work in USD.
Base parameters for Physics Joint
The Joint class in Unity and the Physics Joint class in USD have parameters that are shared by all joints.
Unity |
USD |
Description |
---|---|---|
Body0 |
The target GameObject is used as Body0 of the USD |
|
connectedBody |
Body1 |
The shape specified in connectedBody is used as Body1 in USD |
enableCollision |
CollisionEnabled |
Enable Collision |
anchor |
LocalPosition0 |
Local center position corresponding to Body0 |
connectedAnchor |
LocalPosition1 |
Local center position corresponding to Body1 |
LocalRotation0 |
Local rotation information corresponding to Body0 |
|
LocalRotation1 |
Local rotation information corresponding to Body1 |
|
Break Force |
BreakForce |
Joint break force |
Break Torque |
BreakTorque |
Joint break torque |
LocalRotation0 and LocalRotation1 are automatically calculated from the given GameObject’s transform rotation.
LocalPosition0 / LocalPosition1
LocalPosition0 / LocalPosition1 specifies the center position in local coordinates of Body0 and Body1, respectively.
LocalRotation0 / LocalRotation1
The rotation values for LocalRotation0/LocalRotation1 are the accumulated rotations from the common parent of the shapes corresponding to Body0 and Body1.
If there is rootCube and Cube and the direct parents are the same, the rotation values of the rootCube’s local transform and the Cube’s local transform are adopted, respectively.
Parameters of each Physics Joint
Describe which parameters are passed when passing Physics Joint in Unity to USD.
FixedJoint
HingeJoint
SpringJoint
ConfigurableJoint
CharacterJoint
Example of using Physics Joint
Here is examples of how Physics Joint can be used.
Uses rotation by one axis
Collider assignment
Rigidbody assignment
HingeJoint assignment
Connect multiple Physics Joints
When connecting multiple Rigidbodies in succession, make sure that the Rigidbodies are not nested in the hierarchical structure of the scene.
Adjust the center position with Anchor and the direction of the axis of rotation with Axis.
Check the Use Limits checkbox and specify the Min and Max of the Limit.
Export the USD from Unity and verify that the same movement is made in Omniverse USD Composer.