feat: dynamic point light on a physics ball — falls and illuminates

- LightBall entity: sphere mesh + DynamicSphere physics + Light.Point
- Renderer reads light position from Transform (not static Light.Position)
  so the light moves with the physics body
- Light intensity 20, range 30, warm color (1.0, 0.9, 0.7)
- Ball falls from y=15, bounces on floor, light follows it
- Renderer: prefers Light+Transform pair for dynamic position, falls back to Light only
This commit is contained in:
emil28092005
2026-06-18 19:25:02 +03:00
parent f718e6de49
commit e6cc9e6c4e
2 changed files with 21 additions and 3 deletions
+7
View File
@@ -268,6 +268,13 @@ class Program
.Set(new Transform(new Vector3(0, 8, 0), Quaternion.Identity, Vector3.One))
.Set(Light.Point(new Vector3(0, 8, 0), new Vector3(1.0f, 0.9f, 0.7f), intensity: 15.0f, range: 25.0f));
var lightSphere = ProceduralMesh.CreateSphere(0.5f, 24, 12, new Vector3(1.0f, 0.9f, 0.7f));
world.Entity("LightBall")
.Set(new Transform(new Vector3(0, 15, 0), Quaternion.Identity, Vector3.One))
.Set(lightSphere)
.Set(RigidBody.DynamicSphere(0.5f, mass: 0.5f))
.Set(Light.Point(new Vector3(0, 15, 0), new Vector3(1.0f, 0.9f, 0.7f), intensity: 20.0f, range: 30.0f));
var entityCount = 0;
world.Each((Entity e, ref Transform _) => entityCount++);
Console.WriteLine($"[Scene] {entityCount} entities: torus knot + 4 dynamic cubes + 3 dynamic spheres + static floor + grid");