core/lighting/EntityShadows.cs
public class EntityShadows : Component {
[Property, ReadOnly] public GameObject ShadowCatcher {get; set;}
[Property, ReadOnly] public GameObject SunLight {get; set;}
protected override void OnAwake() {
Tags.Add("entity_shadows");
GameObject.Name = "ENTITY_SHADOWS";
GameObject.Enabled = false;
ShadowCatcher = Scene.CreateObject();
ShadowCatcher.SetParent(GameObject);
ShadowCatcher.Name = "plane";
var model = ShadowCatcher.Components.Create<ModelRenderer>();
model.Model = Model.Load("models/dev/plane.vmdl");
model.MaterialOverride = Material.Load("materials/shadow_catcher.vmat");
ShadowCatcher.WorldScale = 100f;
SunLight = Scene.CreateObject();
SunLight.SetParent(GameObject);
SunLight.Name = "sun";
SunLight.Components.Create<DirectionalLight>();
SunLight.WorldRotation = Rotation.FromPitch(90);
base.OnAwake();
}
}