add root identity set to unparentedbaserigidbodysync

This commit is contained in:
Mister_Nebula 2021-07-17 09:49:36 +01:00
parent aa7f9b810c
commit 8591e2136c

View File

@ -1,7 +1,9 @@
using OWML.Common;
using OWML.Utils;
using QSB.Player.TransformSync;
using QSB.Utility;
using QuantumUNET.Transport;
using System.Linq;
using UnityEngine;
namespace QSB.Syncs.RigidbodySync
@ -17,6 +19,10 @@ namespace QSB.Syncs.RigidbodySync
public virtual void Start()
{
var lowestBound = Resources.FindObjectsOfTypeAll<PlayerTransformSync>()
.Where(x => x.NetId.Value <= NetId.Value).OrderBy(x => x.NetId.Value).Last();
NetIdentity.SetRootIdentity(lowestBound.NetIdentity);
DontDestroyOnLoad(gameObject);
_intermediaryTransform = new IntermediaryTransform(transform);
QSBSceneManager.OnSceneLoaded += OnSceneLoaded;