reajust unabomber cabine pos

This commit is contained in:
2026-09-28 15:54:36 +02:00
parent 769a75f9bb
commit fb630e5a7a
2 changed files with 30 additions and 19 deletions
@@ -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<Pose>();
// 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.