public override void _PhysicsProcess(float delta) { if (do_raycast == true) { do_raycast = false; PhysicsDirectSpaceState spaceState = GetWorld().DirectSpaceState; Godot.Collections.Dictionary results = spaceState.IntersectRay(ray_origin, ray_end, null, 512u); if (results.Count > 0) { if (results["collider"] is Spatial spatial) { if (spatial.GetParent() is Tabs tabs) { currentHighlighted = tabs; tabs.MouseEnter(true); ResetPageFlip(); return; } if (spatial.GetParent() is FlipPages flip) { flipPages = flip; flipPages.Hovering(true); return; } } } if (currentHighlighted != null) { currentHighlighted.MouseEnter(false); currentHighlighted = null; } ResetPageFlip(); } }
private void ResetPageFlip() { if (flipPages != null) { flipPages.Hovering(false); flipPages = null; } }