diff --git a/Assets/_Content/Scenes/Unabomber.unity b/Assets/_Content/Scenes/Unabomber.unity index 0d660fe7..34f4ee58 100644 --- a/Assets/_Content/Scenes/Unabomber.unity +++ b/Assets/_Content/Scenes/Unabomber.unity @@ -513,7 +513,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2322171097057924878, guid: 6b759b091eb288847be06ee6bf319334, type: 3} propertyPath: m_LocalPosition.x - value: 0 + value: -9.026 objectReference: {fileID: 0} - target: {fileID: 2322171097057924878, guid: 6b759b091eb288847be06ee6bf319334, type: 3} propertyPath: m_LocalPosition.y @@ -521,23 +521,23 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2322171097057924878, guid: 6b759b091eb288847be06ee6bf319334, type: 3} propertyPath: m_LocalPosition.z - value: 0 + value: 8.4366 objectReference: {fileID: 0} - target: {fileID: 2322171097057924878, guid: 6b759b091eb288847be06ee6bf319334, type: 3} propertyPath: m_LocalRotation.w - value: 0 + value: 0.42261827 objectReference: {fileID: 0} - target: {fileID: 2322171097057924878, guid: 6b759b091eb288847be06ee6bf319334, type: 3} propertyPath: m_LocalRotation.x - value: -0 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2322171097057924878, guid: 6b759b091eb288847be06ee6bf319334, type: 3} propertyPath: m_LocalRotation.y - value: 1 + value: 0.90630776 objectReference: {fileID: 0} - target: {fileID: 2322171097057924878, guid: 6b759b091eb288847be06ee6bf319334, type: 3} propertyPath: m_LocalRotation.z - value: -0 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2322171097057924878, guid: 6b759b091eb288847be06ee6bf319334, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -545,7 +545,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2322171097057924878, guid: 6b759b091eb288847be06ee6bf319334, type: 3} propertyPath: m_LocalEulerAnglesHint.y - value: 180 + value: 130 objectReference: {fileID: 0} - target: {fileID: 2322171097057924878, guid: 6b759b091eb288847be06ee6bf319334, type: 3} propertyPath: m_LocalEulerAnglesHint.z @@ -1221,7 +1221,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2541733693143394657, guid: 2db7add660a81a342a80b1ba7a331929, type: 3} propertyPath: m_IsActive - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3666808908055770611, guid: 2db7add660a81a342a80b1ba7a331929, type: 3} propertyPath: m_CastShadows @@ -3248,13 +3248,13 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1139105707} serializedVersion: 2 - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -0.88, y: 1.8, z: -2.36} + m_LocalRotation: {x: 0, y: -0.42261827, z: 0, w: 0.90630776} + m_LocalPosition: {x: -7.783788, y: 1.8, z: 6.245502} m_LocalScale: {x: 0.78, y: 1.16, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 122665712} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_LocalEulerAnglesHint: {x: 0, y: -50, z: 0} --- !u!114 &1139105709 MonoBehaviour: m_ObjectHideFlags: 0 @@ -4306,6 +4306,8 @@ MonoBehaviour: heightOffset: 0 rotation: {x: 0, y: 180, z: 0} scaleMultiplier: 1 + keepClear: {fileID: 1874831234} + keepClearRadius: 5 --- !u!114 &1697223357 MonoBehaviour: m_ObjectHideFlags: 0 @@ -4833,7 +4835,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2541733693143394657, guid: 2db7add660a81a342a80b1ba7a331929, type: 3} propertyPath: m_IsActive - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3666808908055770611, guid: 2db7add660a81a342a80b1ba7a331929, type: 3} propertyPath: m_CastShadows @@ -4984,13 +4986,13 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1874831233} serializedVersion: 2 - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0.72, y: 1.265, z: -2.36} + m_LocalRotation: {x: 0, y: -0.42261827, z: 0, w: 0.90630776} + m_LocalPosition: {x: -6.755328, y: 1.265, z: 7.471173} m_LocalScale: {x: 1.1, y: 2.43, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 122665712} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_LocalEulerAnglesHint: {x: 0, y: -50, z: 0} --- !u!114 &1874831235 MonoBehaviour: m_ObjectHideFlags: 0 @@ -5031,13 +5033,13 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1897196756} serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0.72, y: 1.2, z: -2.16} + m_LocalRotation: {x: 0, y: -0.42261827, z: 0, w: 0.90630776} + m_LocalPosition: {x: -6.908537, y: 1.2, z: 7.599731} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1973065515} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_LocalEulerAnglesHint: {x: 0, y: -50, z: 0} --- !u!114 &1897196758 MonoBehaviour: m_ObjectHideFlags: 0 @@ -5408,7 +5410,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2541733693143394657, guid: 2db7add660a81a342a80b1ba7a331929, type: 3} propertyPath: m_IsActive - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3666808908055770611, guid: 2db7add660a81a342a80b1ba7a331929, type: 3} propertyPath: m_CastShadows diff --git a/Assets/_Content/Scripts/PortalServerGrid.cs b/Assets/_Content/Scripts/PortalServerGrid.cs index a978aa19..04066d34 100644 --- a/Assets/_Content/Scripts/PortalServerGrid.cs +++ b/Assets/_Content/Scripts/PortalServerGrid.cs @@ -21,6 +21,9 @@ public sealed class PortalServerGrid : MonoBehaviour [SerializeField] private Vector3 rotation = new Vector3(0, 180, 0); [Tooltip("Multiplier applied to the prefab's original scale.")] [SerializeField, Min(0.001f)] private float scaleMultiplier = 1; + [Tooltip("Optional entrance (e.g. the portal): no server is placed in a circle just past it, along its forward axis.")] + [SerializeField] private Transform keepClear; + [SerializeField, Min(0)] private float keepClearRadius = 5; private PortalMeadow meadow; private GameObject generated; @@ -137,6 +140,9 @@ public sealed class PortalServerGrid : MonoBehaviour lastSize.y * 0.5f - edgeMargin.y) - footprint * 0.5f - Mathf.Abs(offsetZ); float startRadius = Mathf.Max(firstRingRadius, footprint * 0.5f + Mathf.Abs(offsetZ)); var poses = new List(); + // The circle touches the entrance and extends in front of it, so the player never lands in a server. + Vector3 clearCentre = keepClear + ? transform.InverseTransformPoint(keepClear.position + keepClear.forward * keepClearRadius * 0.5f) : Vector3.zero; int ring = 0; for (float radius = startRadius; radius <= maxRadius; radius += ringStep, ring++) { @@ -154,6 +160,9 @@ public sealed class PortalServerGrid : MonoBehaviour { float angle = angleOffset * Mathf.Deg2Rad + (i + (ring % 2) * 0.5f) * Mathf.PI * 2 / around; Vector3 radial = new Vector3(Mathf.Sin(angle), 0, Mathf.Cos(angle)); + Vector3 ringPoint = lastCenter + radial * radius; + if (keepClear && new Vector2(ringPoint.x - clearCentre.x, ringPoint.z - clearCentre.z).magnitude + < keepClearRadius + footprint * 0.5f) continue; Quaternion facing = Quaternion.LookRotation(-radial, Vector3.up); Vector3 position = lastCenter + radial * radius + facing * Vector3.forward * offsetZ; // Bounds already include the prefab rotation, scale and user rotation correction.