Read rendered body wave state from daemon poses

This commit is contained in:
Meta Vens 2026-06-21 15:25:23 +01:00
commit 5bfe9d9b29
4 changed files with 21 additions and 8 deletions

View file

@ -765,7 +765,8 @@ public class DaemonRuntimeDocumentTests
OrbitKey = "orbit:missing",
Kind = "gas_giant",
GravityInfluenceCenterX = -3,
GravityInfluenceCenterZ = 7
GravityInfluenceCenterZ = 7,
GravityWaveSpeed = 3.5
}
}
};
@ -782,6 +783,7 @@ public class DaemonRuntimeDocumentTests
Assert.AreEqual("body:explicit", poses[1].BodyKey);
Assert.AreEqual(-3, poses[1].CenterX, 0.0001);
Assert.AreEqual(7, poses[1].CenterZ, 0.0001);
Assert.AreEqual(3.5, poses[1].GravityWaveSpeed, 0.0001);
}
[Test]

View file

@ -511,17 +511,17 @@ public class ZoneRenderer : MonoBehaviour
if (!_daemonBodyPosesByBodyKey.TryGetValue(planet.Key, out var pose))
continue;
var planetInstance = Zone.PlanetInstances[planet.Key];
var p = new float2((float)pose.CenterX, (float)pose.CenterZ);
var height = GetTerrainHeight(p);
if (-height > maxDepth) maxDepth = -height;
planet.Value.transform.position = new Vector3(p.x, 0, p.y);
planet.Value.Body.transform.localPosition = new Vector3(0, height + planetInstance.BodyRadius * 2, 0);
var bodyRadius = planet.Value.Body.transform.localScale.x;
planet.Value.Body.transform.localPosition = new Vector3(0, height + bodyRadius * 2, 0);
if (planet.Value is GasGiantObject gasGiantObject)
{
gasGiantObject.GravityWaves.material.SetFloat("_Phase",
Zone.Time * ((GasGiant) Zone.PlanetInstances[planet.Key]).GravityWavesSpeed);
if (!(planet.Value is SunObject))
Zone.Time * (float)pose.GravityWaveSpeed);
if (!string.Equals(pose.Kind, "sun", StringComparison.OrdinalIgnoreCase))
{
var parent = new float2((float)pose.ParentCenterX, (float)pose.ParentCenterZ);
var toParent = normalize(parent - p);