mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-01 03:32:38 +00:00
use SetPos/Rot to have suspended thing work
This commit is contained in:
parent
e348efef88
commit
d86b6c41ab
@ -1,11 +1,6 @@
|
||||
using QSB.Syncs.Sectored.Rigidbodies;
|
||||
using QSB.Utility.LinkedWorldObject;
|
||||
using QSB.Utility;
|
||||
using QSB.WorldSync;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace QSB.ModelShip.TransformSync;
|
||||
|
||||
@ -35,4 +30,29 @@ internal class ModelShipTransformSync : SectoredRigidbodySync
|
||||
SectorDetector.Init(modelShip.transform.Find("Detector").GetComponent<SectorDetector>());
|
||||
return modelShip;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// replacement for base method
|
||||
/// using SetPos/Rot instead of Move
|
||||
/// </summary>
|
||||
protected override void ApplyToAttached()
|
||||
{
|
||||
ApplyToSector();
|
||||
if (!ReferenceTransform)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var targetPos = ReferenceTransform.FromRelPos(SmoothPosition);
|
||||
var targetRot = ReferenceTransform.FromRelRot(SmoothRotation);
|
||||
|
||||
AttachedRigidbody.SetPosition(targetPos);
|
||||
AttachedRigidbody.SetRotation(targetRot);
|
||||
|
||||
var targetVelocity = ReferenceRigidbody.FromRelVel(Velocity, targetPos);
|
||||
var targetAngularVelocity = ReferenceRigidbody.FromRelAngVel(AngularVelocity);
|
||||
|
||||
AttachedRigidbody.SetVelocity(targetVelocity);
|
||||
AttachedRigidbody.SetAngularVelocity(targetAngularVelocity);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user