Fixes to vertex snapping

#2045
This commit is contained in:
Wojtek Figat
2024-02-24 23:35:56 +01:00
parent 1dfc8b0a47
commit 124832b076
3 changed files with 19 additions and 42 deletions

View File

@@ -231,7 +231,7 @@ namespace FlaxEditor.SceneGraph
/// <summary>
/// The list of objects to exclude from tracing against. Null if unused.
/// </summary>
public List<object> ExcludeObjects;
public List<SceneGraphNode> ExcludeObjects;
/// <summary>
/// Initializes a new instance of the <see cref="RayCastData"/> struct.
@@ -326,19 +326,12 @@ namespace FlaxEditor.SceneGraph
private bool RayMask(ref RayCastData ray)
{
if (ray.ExcludeObjects != null)
if (ray.ExcludeObjects != null && ray.ExcludeObjects.Remove(this))
{
for (int j = 0; j < ray.ExcludeObjects.Count; j++)
{
if (ray.ExcludeObjects[j] == EditableObject)
{
// Remove form exclude because it is passed by ref and function is recursive it will slowly shrink the list until nothing is left as a micro optimization
ray.ExcludeObjects.RemoveAt(j);
if (ray.ExcludeObjects.Count == 0)
ray.ExcludeObjects = null;
return false;
}
}
// Remove form exclude because it is passed by ref and function is recursive it will slowly shrink the list until nothing is left as a micro optimization
if (ray.ExcludeObjects.Count == 0)
ray.ExcludeObjects = null;
return false;
}
return true;
}