Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Sync cloth proxy source cloth over network
#1
Good day.

I have a high poly Obi cloth proxy that is a dense wire mesh (at about 12000 vertices) with a source cloth that is a very simple plane (at around 110 vertices).
The goal of this is to manipulate the source cloth using Obi particle attachment to place the wire mesh over a section of a wall. There's a good deal of cloth interaction with Obi colliders as well.

What I want to do is run the cloth simulation on a single central PC (called it the primary node) and have the obi cloth proxy behave exactly the same way on three other PCs (called them the secondary nodes). These secondary nodes are used for rendering different views(left, front and right); so it's very important that the cloth's positions and behavior is consistent between the secondary nodes (for an extreme example some vertices might have sunk through the wall on the left view rendering secondary node, but are fine on the front view render secondary node). 

My first plan was to try use a byte[] to sync the vertex positions of the high poly mesh on the primary node to the instances of the high poly mesh on the secondary nodes. Directly applying the Vector3[] of the mesh vertices from one mesh to another was easy for Unity. Unfortunately it is very costly to convert that same Vector3[] into a byte[] to transfer over a network, and then converting back into the Vector3[] to apply to the high poly mesh on the secondary nodes. 

So I was hoping there was a way to apply changes in vertex positions on the source cloth; unfortunately this doesn't seem possible while it's being used as part of the obi cloth system. This might work by removing all the Obi cloth system from the secondary nodes, but then the proxy would no longer work (because it needs the obi solver to function).

TLDR: I want to serialize a cloth from one PC to another so that I know for a certainty that it's visually the same.

Is there a simpler solution that I've missed perhaps? 
Any ideas or help would be greatly appreciated!
Reply
#2
Hi there!

You could try just fixing the particles in place, and overriding their positions manually (with the network data). This way you only need to sync particle positions.

When you set the particle inverse mass to zero, it is considered "fixed" in place. Then you can override its position manually. See:
http://obi.virtualmethodstudio.com/manua...icles.html

Quote:Inverse mass for each particle. An inverse mass of 0 means the particle's mass is infinite, so its position will be unaffected by dynamics (allowing you to override it manually).
Reply
#3
Thanks very much! That actually sounds like it's exactly what I am after! I'll set up a test case and see what happens! Once I've got something functional I'll check back in here.
I was beginning to suspect I might be getting a little ambitious with how much data I'm trying to serialize but this will certainly help to bring that down.

Edit:
That worked perfectly! Access to the particles was certainly something I had wondered about but had not found yet; and boy is it far better than trying to sync all those vertices from the high poly mesh. Thanks again!
Reply