// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. #if USE_LARGE_WORLDS using Real = System.Double; #else using Real = System.Single; #endif using FlaxEngine; namespace FlaxEditor.SceneGraph.Actors { /// /// Scene tree node for actor type. /// /// [HideInEditor] public sealed class UICanvasNode : ActorNode { /// public UICanvasNode(Actor actor) : base(actor) { } /// public override void PostSpawn() { base.PostSpawn(); // Rotate to match the space (GUI uses upper left corner as a root) Actor.LocalOrientation = Quaternion.Euler(0, -180, -180); } /// public override bool RayCastSelf(ref RayCastData ray, out Real distance, out Vector3 normal) { normal = Vector3.Up; if (Actor is UICanvas uiCanvas && uiCanvas.Is3D) return uiCanvas.Bounds.Intersects(ref ray.Ray, out distance); distance = 0; return false; } /// public override void OnDebugDraw(ViewportDebugDrawData data) { base.OnDebugDraw(data); if (Actor is UICanvas uiCanvas && uiCanvas.Is3D) DebugDraw.DrawWireBox(uiCanvas.Bounds, Color.BlueViolet); } } }