-
-
Notifications
You must be signed in to change notification settings - Fork 114
Description
Hi,
I am wondering whether we can make the templates serializable, specifically, serializable with DataContractSerializer and BinaryFormatter. By storing the template in resources instead of hard-code in C# one by one, it will definitely make the built-in template more useful when we are serializing a game scene.
I am also wondering whether we can add a list/array of FixtureTemplate in BodyTemplate, which allows us to store only one BodyTemplate to create on body. Now we need to specify a BodyTemplate and attach several Fixtures. Also this does the same as FixtureTemplate, which contains a Shape (or ShapeTemplate, please below). The final goal is to make template easier to use, especially more friendly to game scene serialization.
If you think it's reasonable, I can make a pull request. This requires the following work:
- Add attributes to classes and properties.
- Add default constructors.
- Change Shape in FixtureTemplate to ShapeTemplate, and Body to BodyTemplate in JointTemplate. Compared with their templates, Shape and Body are difficult to serialize.
- Add an array of FixtureTemplate in BodyTemplate.
- Add a helper function in Factory class to create Body and Joint objects in a World.
This may requires more tests, but I don't have a clear idea on how to do that yet. What are your suggestions?
Thanks.