A game Component that keeps its WorldPosition horizontally aligned with the local player by copying the player's X and Y each update while preserving its own Z coordinate. Intended to make an effect follow the player on the ground plane (e.g. snow).
using Sandbox;
public sealed class LevelSnowEffect : Component
{
protected override void OnUpdate()
{
var player = Manager.Instance.LocalPlayer;
if( !player.IsValid() )
return;
WorldPosition = player.WorldPosition.WithZ( WorldPosition.z );
}
}