mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-04-16 14:42:35 +00:00
undetached fragment does not have a rigidbody
This commit is contained in:
parent
d11591b904
commit
a40d8a2cf5
@ -40,8 +40,8 @@ namespace QSB.MeteorSync.Events
|
|||||||
msg.LeashLength = qsbFragment.LeashLength;
|
msg.LeashLength = qsbFragment.LeashLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
var refBody = GetRefBody(msg.IsThruWhiteHole);
|
var refBody = qsbFragment.RefBody;
|
||||||
var body = qsbFragment.AttachedObject.transform.parent.parent.GetAttachedOWRigidbody();
|
var body = qsbFragment.Body;
|
||||||
msg.Pos = refBody.transform.InverseTransformPoint(body.transform.position);
|
msg.Pos = refBody.transform.InverseTransformPoint(body.transform.position);
|
||||||
msg.Rot = refBody.transform.InverseTransformRotation(body.transform.rotation);
|
msg.Rot = refBody.transform.InverseTransformRotation(body.transform.rotation);
|
||||||
msg.Vel = GetRelativeVelocity(body, refBody);
|
msg.Vel = GetRelativeVelocity(body, refBody);
|
||||||
@ -65,7 +65,7 @@ namespace QSB.MeteorSync.Events
|
|||||||
|
|
||||||
if (msg.Integrity <= 0)
|
if (msg.Integrity <= 0)
|
||||||
{
|
{
|
||||||
// the detach is delay, so wait even more until that happens lol
|
// the detach is delayed, so wait even more until that happens lol
|
||||||
QSBCore.UnityEvents.FireInNUpdates(() =>
|
QSBCore.UnityEvents.FireInNUpdates(() =>
|
||||||
{
|
{
|
||||||
if (msg.IsThruWhiteHole && !qsbFragment.IsThruWhiteHole)
|
if (msg.IsThruWhiteHole && !qsbFragment.IsThruWhiteHole)
|
||||||
@ -86,7 +86,7 @@ namespace QSB.MeteorSync.Events
|
|||||||
Application.Quit();
|
Application.Quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
var refBody = GetRefBody(msg.IsThruWhiteHole);
|
var refBody = qsbFragment.RefBody;
|
||||||
var body = qsbFragment.Body;
|
var body = qsbFragment.Body;
|
||||||
var targetPos = refBody.transform.TransformPoint(msg.Pos);
|
var targetPos = refBody.transform.TransformPoint(msg.Pos);
|
||||||
var targetRot = refBody.transform.TransformRotation(msg.Rot);
|
var targetRot = refBody.transform.TransformRotation(msg.Rot);
|
||||||
@ -101,9 +101,6 @@ namespace QSB.MeteorSync.Events
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static OWRigidbody GetRefBody(bool isThruWhiteHole) =>
|
|
||||||
isThruWhiteHole ? MeteorManager.WhiteHoleVolume._whiteHoleBody : Locator._brittleHollow._owRigidbody;
|
|
||||||
|
|
||||||
// code yoink from transform sync lol
|
// code yoink from transform sync lol
|
||||||
private static void SetVelocity(OWRigidbody rigidbody, Vector3 relativeVelocity)
|
private static void SetVelocity(OWRigidbody rigidbody, Vector3 relativeVelocity)
|
||||||
{
|
{
|
||||||
|
@ -25,10 +25,9 @@ namespace QSB.MeteorSync.WorldObjects
|
|||||||
|
|
||||||
public DetachableFragment DetachableFragment;
|
public DetachableFragment DetachableFragment;
|
||||||
public bool IsThruWhiteHole => DetachableFragment._sector._parentSector == MeteorManager.WhiteHoleVolume._whiteHoleSector;
|
public bool IsThruWhiteHole => DetachableFragment._sector._parentSector == MeteorManager.WhiteHoleVolume._whiteHoleSector;
|
||||||
public OWRigidbody refBody => IsThruWhiteHole ? MeteorManager.WhiteHoleVolume._whiteHoleBody :
|
public OWRigidbody RefBody => IsThruWhiteHole ? MeteorManager.WhiteHoleVolume._whiteHoleBody :
|
||||||
Locator._brittleHollow._owRigidbody;
|
Locator._brittleHollow._owRigidbody;
|
||||||
public OWRigidbody Body => IsThruWhiteHole ? AttachedObject.transform.parent.parent.GetAttachedOWRigidbody() :
|
public OWRigidbody Body => IsThruWhiteHole ? AttachedObject.transform.parent.parent.GetAttachedOWRigidbody() : null;
|
||||||
AttachedObject.GetAttachedOWRigidbody();
|
|
||||||
|
|
||||||
/// what the leash length will be when we eventually detach and fall thru white hole
|
/// what the leash length will be when we eventually detach and fall thru white hole
|
||||||
public float LeashLength;
|
public float LeashLength;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user