17-07-2017, 02:02 PM
I'm looking to sync the position of the rope over a network, my initial test is getting the positions of the particles via the
method, networking these values, then setting them on the other side, however I cannot seem to set them. My current attempt is as follows;
I can confirm that state.RopePositions contains the correct values when referenced by the client, but I'm unable to tell the solver to use these positions. Is this a thing that is even possible with ObiRope? Am I going about this all wrong? Any help would be appreciated!
Code:
ObiRope.GetParticles(index)
method, networking these values, then setting them on the other side, however I cannot seem to set them. My current attempt is as follows;
Code:
private void SetPositions()
{
if (entity.isAttached)
{
for (int i = 0; i < ObiRope.UsedParticles && i < PositionArrayHardLimit; i++)
{
state.RopePositions[i] = ObiRope.GetParticlePosition(i);
}
}
}
private void GetPositions()
{
if (entity.isAttached)
{
for (int i = 0; i < ObiRope.UsedParticles && i < PositionArrayHardLimit; i++)
{
ObiRope.Solver.renderablePositions[ObiRope.particleIndices[i]] = state.RopePositions[i];
ObiRope.Solver.UpdateActiveParticles();
}
}
}