Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Synchronizing softbody, doesn't render
#1
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:

[Image: r91h9FW.png]

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:

[Image: tF2z4l3.png]}

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?
Reply


Messages In This Thread
Synchronizing softbody, doesn't render - by Milionario - 06-12-2022, 02:41 PM