feat: light moves in chaotic circle — dynamic shadows

- Light position animated with sin/cos combinations at different frequencies
- XZ plane: figure-8 pattern (sin*0.7 + cos*0.3, cos*0.6 + sin*0.4)
- Y: oscillates 7-17 with sin*0.5
- Shadows move dynamically as light orbits the scene
This commit is contained in:
emil28092005
2026-06-18 20:15:36 +03:00
parent d4eafe1f31
commit df4b30ecc3
+15
View File
@@ -70,6 +70,7 @@ class Program
var frames = 0;
var lastFpsTime = 0.0;
var timing = new Timing();
var totalTime = 0.0f;
while (!window.ShouldClose)
{
@@ -111,6 +112,7 @@ class Program
}
cameraController.Update(input, (float)timing.DeltaTime);
totalTime += (float)timing.DeltaTime;
var toInit = new List<(Entity, RigidBody, Transform)>();
world.Each((Entity e, ref RigidBody rb, ref Transform t) =>
@@ -130,6 +132,19 @@ class Program
physicsWorld.Update((float)timing.DeltaTime);
physicsWorld.SyncTransforms(world);
// Move light in a chaotic circle
var lightEntity = world.Lookup("MainLight");
if ((ulong)lightEntity.Id != 0)
{
var t = totalTime;
var lx = MathF.Sin(t * 0.7f) * 8f + MathF.Cos(t * 0.3f) * 3f;
var ly = 12f + MathF.Sin(t * 0.5f) * 5f;
var lz = MathF.Cos(t * 0.6f) * 8f + MathF.Sin(t * 0.4f) * 3f;
var lt = lightEntity.Get<Transform>();
lt.Position = new Vector3(lx, ly, lz);
lightEntity.Set(lt);
}
var processed = queue.ProcessPending();
if (processed > 0)
Console.WriteLine($"[App] Processed {processed} AI command(s)");