@using Sandbox; @using Sandbox.UI; @namespace LuckerGame.UI @attribute [StyleSheet] @inherits WorldPanel @code { private Entity TargetEntity; private string Text; public HoveringText(string text, Entity targetEntity) { Text = text; TargetEntity = targetEntity; } [GameEvent.Client.Frame] private void OnFrame() { if (!TargetEntity.IsValid()) return; Log.Info($"{Text} to {TargetEntity.Position}"); Position = TargetEntity.Position + Vector3.Up * 65f; Rotation = Rotation.LookAt(-Screen.GetDirection(new Vector2(Screen.Width * 0.5f, Screen.Height * 0.5f))); } }