- Home /
Serializing Joint State
I'm having serious difficulty writing a script to serialize the state of two rigidbodies connected by a joint.
The problem is that as well as the fields contained in the API, joints seem to contain hidden state during simulation which can be neither read nor written.
For example: Suppose I have two objects connected by a HingeJoint and one is subjected to a force parallel to the axis of rotation. This distorts the joint (which is not perfectly rigid of course). If I serialize this system and then instantiate it from the stored state it will either deserialize in a different position or in the same position but with the two halves of the joint now permanently in that relationship to each other (ie. no restoring force will be applied by the system).
Is there any way to do what I'm trying to do? Or, failing that, how should I work around it if I need to serialize complicated systems involving many joints and rigidbodies?
Your answer
![](https://koobas.hobune.stream/wayback/20220612094806im_/https://answers.unity.com/themes/thub/images/avi.jpg)