16-01-2019, 05:03 AM
(This post was last modified: 16-01-2019, 05:11 AM by Loki_Priest.)
Hello.
I need to save disposed positions of particles (or vertices) after closing the game and to load them when I start the game.
I managed to write actor's positions and obiCloth's meshVertices arrays to XML files and to read them.
But I faced with two problems:
1) It's ok to SetParticlePositions using the values from the file; but it was not possible to get changed positions of particles (I mean the position[] array doesn't change, however the real picture is ok while deforming the object). Maybe it's necessary to RequireRenderablePosition (or/and PullDataFromSolver), isn't it?
2) On the other hand, values of meshVertices array change when I deform the mesh, but I have no luck in changing them manually with the values from the XML file (I mean the clothMesh from ObiClothBase class).
Maybe I missed something important?
For clarity, here is an example of what I need:
1) I start my game with a ball.
[attachment=215]
2) Then I deform it (via the "finger" collider), save it, and quit the game.
[attachment=217]
3) When I open the game again I am to see the second picture.
I need to save disposed positions of particles (or vertices) after closing the game and to load them when I start the game.
I managed to write actor's positions and obiCloth's meshVertices arrays to XML files and to read them.
But I faced with two problems:
1) It's ok to SetParticlePositions using the values from the file; but it was not possible to get changed positions of particles (I mean the position[] array doesn't change, however the real picture is ok while deforming the object). Maybe it's necessary to RequireRenderablePosition (or/and PullDataFromSolver), isn't it?
2) On the other hand, values of meshVertices array change when I deform the mesh, but I have no luck in changing them manually with the values from the XML file (I mean the clothMesh from ObiClothBase class).
Maybe I missed something important?
For clarity, here is an example of what I need:
1) I start my game with a ball.
[attachment=215]
2) Then I deform it (via the "finger" collider), save it, and quit the game.
[attachment=217]
3) When I open the game again I am to see the second picture.