check ground body

This commit is contained in:
JohnCorby 2022-12-31 15:14:06 -08:00
parent ceb899d985
commit 3d43f26816
2 changed files with 14 additions and 2 deletions

View File

@ -10,7 +10,13 @@ namespace QSB.EchoesOfTheEye.RaftSync.TransformSync;
public class RaftTransformSync : UnsectoredRigidbodySync, ILinkedNetworkBehaviour
{
private bool ShouldMovePlayer => Vector3.Distance(AttachedTransform.position, Locator.GetPlayerBody().GetPosition()) < 10;
private bool ShouldMovePlayer =>
Locator.GetPlayerController() &&
(
Locator.GetPlayerController().GetGroundBody() == null ||
Locator.GetPlayerController().GetGroundBody() == AttachedRigidbody
) &&
Vector3.Distance(AttachedTransform.position, Locator.GetPlayerBody().GetPosition()) < 10;
protected override bool UseInterpolation => !ShouldMovePlayer;
private float _lastSetPositionTime;

View File

@ -118,6 +118,12 @@ public class ShipTransformSync : SectoredRigidbodySync
#endregion
private bool ShouldMovePlayer => Vector3.Distance(AttachedTransform.position, Locator.GetPlayerBody().GetPosition()) < 20;
private bool ShouldMovePlayer =>
Locator.GetPlayerController() &&
(
Locator.GetPlayerController().GetGroundBody() == null ||
Locator.GetPlayerController().GetGroundBody() == AttachedRigidbody
) &&
Vector3.Distance(AttachedTransform.position, Locator.GetPlayerBody().GetPosition()) < 100;
protected override bool UseInterpolation => !ShouldMovePlayer;
}