fix desync

This commit is contained in:
mischa 2024-04-25 20:13:46 +08:00
parent ae875b4f05
commit fc2f2291c8

View File

@ -87,6 +87,13 @@ protected override void Awake()
// make sure predicted physics look smooth // make sure predicted physics look smooth
predictedRigidbody.interpolation = RigidbodyInterpolation.Interpolate; predictedRigidbody.interpolation = RigidbodyInterpolation.Interpolate;
// hard disable only-sync-on-change for now.
// causes issues where clients objects may be too far off from server pos.
// and then addforce puts them even further off and they get out of sync forever.
// because addforce on server thinks the object is elsewhere.
// TODO instead of only sync on change, we need only sync every 500ms if idle
onlySyncOnChange = false;
// cache computations // cache computations
velocitySensitivitySqr = velocitySensitivity * velocitySensitivity; velocitySensitivitySqr = velocitySensitivity * velocitySensitivity;
angularVelocitySensitivitySqr = angularVelocitySensitivity * angularVelocitySensitivity; angularVelocitySensitivitySqr = angularVelocitySensitivity * angularVelocitySensitivity;