mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-21 09:39:56 +00:00
SectoredRigidbodySync: set transform.position to Vector3.zero if ReferenceTransform is null, like in SectoredTransformSync
This commit is contained in:
parent
906c5448d2
commit
078ac3b863
@ -94,10 +94,20 @@ namespace QSB.Syncs.Sectored.Rigidbodies
|
||||
|
||||
protected void SetValuesToSync()
|
||||
{
|
||||
transform.position = ReferenceTransform.EncodePos(AttachedObject.transform.position);
|
||||
transform.rotation = ReferenceTransform.EncodeRot(AttachedObject.transform.rotation);
|
||||
_relativeVelocity = ReferenceTransform.GetAttachedOWRigidbody().EncodeVel(((OWRigidbody)AttachedObject).GetVelocity(), AttachedObject.transform.position);
|
||||
_relativeAngularVelocity = ReferenceTransform.GetAttachedOWRigidbody().EncodeAngVel(((OWRigidbody)AttachedObject).GetAngularVelocity());
|
||||
if (ReferenceTransform != null)
|
||||
{
|
||||
transform.position = ReferenceTransform.EncodePos(AttachedObject.transform.position);
|
||||
transform.rotation = ReferenceTransform.EncodeRot(AttachedObject.transform.rotation);
|
||||
_relativeVelocity = ReferenceTransform.GetAttachedOWRigidbody().EncodeVel(((OWRigidbody)AttachedObject).GetVelocity(), AttachedObject.transform.position);
|
||||
_relativeAngularVelocity = ReferenceTransform.GetAttachedOWRigidbody().EncodeAngVel(((OWRigidbody)AttachedObject).GetAngularVelocity());
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.position = Vector3.zero;
|
||||
transform.rotation = Quaternion.identity;
|
||||
_relativeVelocity = Vector3.zero;
|
||||
_relativeAngularVelocity = Vector3.zero;
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool UpdateTransform()
|
||||
|
Loading…
x
Reference in New Issue
Block a user