06-12-2022, 02:41 PM
(This post was last modified: 06-12-2022, 02:43 PM by Milionario.)
So I tried using the same script I had for synchronizing ropes, but instead of using a ObiRope component, I replaced it with ObiActor for a more general approach since it's just synchronizing particles. The ropes work fine but the softbody doesn't, the positions are received correctly, I am drawing debug lines to visualize them:
You can see the softbody shape, its there.
This script works just fine for ropes, there isn't any rope specific code there.
This is how I am setting the solver positions
This is where I actually set the particles positions in the solver:
Gettings lots of these:
}
So it looks like its trying to set invalid values for the softbody transform on Softbody script line 281
It works just fine for the ropes and its the same component that i am using to synchronize them, what can I do to track this problem down?
You can see the softbody shape, its there.
This script works just fine for ropes, there isn't any rope specific code there.
This is how I am setting the solver positions
Code:
var wantedHostTimeStamp = Host.Now - HostTimespan.FromSeconds(ReceiveDelay);
var states = GetStatesAroundHostTimeStamp(wantedHostTimeStamp);
if (states.HasStates)
{
var interpolationFactor = GetInterpolationFactorBetweenStates(wantedHostTimeStamp, states.Item1, states.Item2);
for (int i = 0; i < actor.activeParticleCount; i++)
{
var globalPosition = actor.solver.transform.TransformPoint(Vector3.Lerp(states.Item1.Positions[i], states.Item2.Positions[i], interpolationFactor));
Debug.DrawLine(Vector3.zero, globalPosition);
actor.solver.positions[actor.solverIndices[i]] = Vector3.Lerp(states.Item1.Positions[i], states.Item2.Positions[i], interpolationFactor);
actor.solver.invMasses[actor.solverIndices[i]] = 0;
}
}
This is where I actually set the particles positions in the solver:
Code:
actor.solver.positions[actor.solverIndices[i]] = Vector3.Lerp(states.Item1.Positions[i], states.Item2.Positions[i], interpolationFactor);
actor.solver.invMasses[actor.solverIndices[i]] = 0;
Gettings lots of these:
}
So it looks like its trying to set invalid values for the softbody transform on Softbody script line 281
It works just fine for the ropes and its the same component that i am using to synchronize them, what can I do to track this problem down?