Obi Official Forum
Rope Position Inconsistencies over Network - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html)
+--- Thread: Rope Position Inconsistencies over Network (/thread-90.html)



Rope Position Inconsistencies over Network - PhantomBadger - 30-08-2017

Hi all,

Im currently working on a networked app with ObiRope, and we have a slight issue wherein the rope has slightly inconsistent positions when networked, now a slight difference is ok, but the difference at the edge of the rope - where it is connected to an object, are quite drastic, often having the rope stick out (See Image below)

[Image: ropepositioncomparisons.png]

For reference, my rope set up is structured as follows:

[Image: ObiRopeSetupDiagram.png]

A - End-point Object A (Connection A in Hierarchy)
B - End-point Connector Object A (Point A in Hierarchy)
C - Obi Rope
[d]D[/d] - End-point Connector Object B (Point B in Hierarchy)
[e]E[/e] - End-point Object B (Connection B in Hierarchy)

[Image: ObiRopeHierarchy.PNG]

Now, my original concern was this was an issue with my network solution. My current solution is to network the positions of the used particles in the ObiRope, Getting and setting them into Oni on each end. This was due to a client requirement to have 1-1 Rope Positions across client and server.

Used by the Server to assign positions to the network:
Code:
   /// <summary>
   /// Sets the rope's current positions to the network using the Oni C++ Solver
   /// </summary>
   private void SetPositions()
   {
       if (entity.isAttached && ObiRope.particleIndices != null)
       {
           //Get the particle positions through the Oni .dll
           Vector4[] particlePositions = new Vector4[ObiRope.UsedParticles];
           Oni.GetParticlePositions(ObiRope.Solver.OniSolver, particlePositions, ObiRope.UsedParticles, ObiRope.particleIndices[0]);

           //Bind them to the network until we're done or hit the hard limit
           for (int i = 0; i < particlePositions.Length && i < PositionArrayHardLimit; i++)
           {
               state.RopePositions[i] = particlePositions[i];
           }
       }
   }

Used by the client to get positions from the network
Code:
   /// <summary>
   /// Gets the rope's current positions from the network and sets our locals to that
   /// </summary>
   private void GetPositions()
   {
       if (entity.isAttached && ObiRope.particleIndices != null)
       {
           //Create a temporary array to hold all the particles we use
           Vector4[] newPositions = new Vector4[ObiRope.UsedParticles];

           //Retrieve the values from the network until we have them all or hit our hard limit
           for (int i = 0; i < newPositions.Length && i < PositionArrayHardLimit; i++)
           {
               newPositions[i] = state.RopePositions[i];
           }

           //Set the particle positions using the Oni .dll in order to apply to the rope
           Oni.SetParticlePositions(ObiRope.Solver.OniSolver, newPositions, newPositions.Length, ObiRope.particleIndices[0]);
       }
   }

With this in mind what could be causing this difference? Especially such a major difference at each end of the rope? My initial thought is it is the rendering portion of the set up, but I'm not sure.

Thanks!

EDIT:
From some further investigation, using Handles seems to be 100% fine, but then I cant move the other end of the rope by using the first, so I would assume the issue is with the pin constraints?


RE: Rope Position Inconsistencies over Network - PhantomBadger - 30-08-2017

All Fixed!

Should anyone else be having issues with the pin constraints like myself, my issue was that the anchor and the particles both had a mass of 0.1, meaning there wasnt a lot of influence between them. The colliders for the anchor were also disabled on the clients, causing the constraints to not work at all!