From 68d97fcc485f7295095a4d7b8942320bca858985 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Fri, 14 Jul 2023 14:17:19 +0200 Subject: [PATCH] Improve cloth paint picking logic --- Source/Editor/Tools/ClothPainting.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/Editor/Tools/ClothPainting.cs b/Source/Editor/Tools/ClothPainting.cs index 2ad3b94a1..c831eb35d 100644 --- a/Source/Editor/Tools/ClothPainting.cs +++ b/Source/Editor/Tools/ClothPainting.cs @@ -222,6 +222,16 @@ namespace FlaxEngine.Tools { // Cursor hit other object or nothing PaintEnd(); + + if (Owner.IsLeftMouseButtonDown) + { + // Select something else + var view = new Ray(Owner.ViewPosition, Owner.ViewDirection); + var rayCastFlags = SceneGraphNode.RayCastData.FlagTypes.SkipColliders | SceneGraphNode.RayCastData.FlagTypes.SkipEditorPrimitives; + var hit = Owner.SceneGraphRoot.RayCast(ref ray, ref view, out _, rayCastFlags); + if (hit != null && hit is ActorNode) + Owner.Select(new List { hit }); + } return; } @@ -234,16 +244,6 @@ namespace FlaxEngine.Tools PaintUpdate(); } - public override void Pick() - { - var ray = Owner.MouseRay; - var view = new Ray(Owner.ViewPosition, Owner.ViewDirection); - var rayCastFlags = SceneGraphNode.RayCastData.FlagTypes.SkipColliders | SceneGraphNode.RayCastData.FlagTypes.SkipEditorPrimitives; - var hit = Owner.SceneGraphRoot.RayCast(ref ray, ref view, out _, rayCastFlags); - if (hit != null && hit is ActorNode) - Owner.Select(new List { hit }); - } - public override void Draw(ref RenderContext renderContext) { if (!IsActive || !_cloth)