Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Obi Ropes Multiplayer Sync
#4
(27-09-2023, 08:59 PM)fevzi Wrote: moved all to the EndStep function but tension still not syncing Code

There's lots of issues with your code:

- I don't know which networking system are you using, but this code:

Code:
public void OnEnable()
    {
        if (IsClient)
        {
            GetComponent<ObiActor>().OnEndStep += EndStep;
        }
    }

Looks as if only the client subscribes to OnEndStep. In OnEndStep you're checking whether the subscriber "IsServer" before sending data, but since only clients subscribe, no data will ever be sent. Might be the case that the server is also a client, but you should definitely look into this just in case.

- You're synchronizing invRotationalMasses: which is only used by oriented particles in rods. It is unused by ropes.
- You're synchronizing invMasses, these values don't change at runtime (unless you explicitly change them) so no need to synchronize them.
- You're synchronizing externalForces and externalTorques, which as the name implies they're used to inject external forces/torques into the simulation and will be zero unless you explicitly set their values. No need to synchronize.

- You're not synchronizing startPositions and prevPositions, which are used to interpolate physics state, so state interpolation will break.
- You're not synchronizing velocities (may or may not be needed for your specific use case).
- You're using rope.GetParticleRuntimeIndex(i), which returns the index of the particle either in the actor or the solver. This is intended to be used when writing editor tools only, at runtime you should use rope.solverIndices instead.

I'd suggest taking a look at the scripting section of the manual for details.
Reply


Messages In This Thread
Obi Ropes Multiplayer Sync - by fevzi - 27-09-2023, 04:25 PM
RE: Obi Ropes Multiplayer Sync - by josemendez - 27-09-2023, 06:01 PM
RE: Obi Ropes Multiplayer Sync - by fevzi - 27-09-2023, 08:59 PM
RE: Obi Ropes Multiplayer Sync - by josemendez - 28-09-2023, 08:24 AM
RE: Obi Ropes Multiplayer Sync - by fevzi - 28-09-2023, 09:28 AM
RE: Obi Ropes Multiplayer Sync - by josemendez - 28-09-2023, 09:34 AM
RE: Obi Ropes Multiplayer Sync - by fevzi - 01-10-2023, 03:28 PM