Improve cloth paint picking logic

This commit is contained in:
Wojtek Figat
2023-07-14 14:17:19 +02:00
parent 3f9e286279
commit 68d97fcc48

View File

@@ -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<SceneGraphNode> { 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<SceneGraphNode> { hit });
}
public override void Draw(ref RenderContext renderContext)
{
if (!IsActive || !_cloth)