mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-13 12:40:50 +00:00
Alek/floating bodies (#48)
* spawning all remote synced objects in sun - also moving to sun if in center
This commit is contained in:
parent
26dd171a2b
commit
7b707be963
@ -25,6 +25,11 @@ namespace QSB
|
||||
_shipPrefab.AddComponent<ShipTransformSync>();
|
||||
spawnPrefabs.Add(_shipPrefab);
|
||||
|
||||
ConfigureNetworkManager();
|
||||
}
|
||||
|
||||
private void ConfigureNetworkManager()
|
||||
{
|
||||
networkAddress = QSB.DefaultServerIP;
|
||||
maxConnections = MaxConnections;
|
||||
customConfig = true;
|
||||
|
@ -37,6 +37,10 @@ namespace QSB.TransformSync
|
||||
|
||||
transform.parent = Locator.GetRootTransform();
|
||||
_syncedTransform = hasAuthority ? InitLocalTransform() : InitRemoteTransform();
|
||||
if (!hasAuthority)
|
||||
{
|
||||
_syncedTransform.position = Locator.GetAstroObject(AstroObject.Name.Sun).transform.position;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetFirstSector()
|
||||
@ -66,10 +70,17 @@ namespace QSB.TransformSync
|
||||
}
|
||||
else
|
||||
{
|
||||
_syncedTransform.parent = sectorTransform;
|
||||
if (_syncedTransform.position == Vector3.zero)
|
||||
{
|
||||
_syncedTransform.position = Locator.GetAstroObject(AstroObject.Name.Sun).transform.position;
|
||||
}
|
||||
else
|
||||
{
|
||||
_syncedTransform.parent = sectorTransform;
|
||||
|
||||
_syncedTransform.localPosition = Vector3.SmoothDamp(_syncedTransform.localPosition, transform.position, ref _positionSmoothVelocity, SmoothTime);
|
||||
_syncedTransform.localRotation = QuaternionHelper.SmoothDamp(_syncedTransform.localRotation, transform.rotation, ref _rotationSmoothVelocity, Time.deltaTime);
|
||||
_syncedTransform.localPosition = Vector3.SmoothDamp(_syncedTransform.localPosition, transform.position, ref _positionSmoothVelocity, SmoothTime);
|
||||
_syncedTransform.localRotation = QuaternionHelper.SmoothDamp(_syncedTransform.localRotation, transform.rotation, ref _rotationSmoothVelocity, Time.deltaTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user