Files
FlaxEngine/Source/Editor/SceneGraph/ActorNodeWithIcon.cs
2021-01-02 14:28:49 +01:00

37 lines
1.1 KiB
C#

// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
using FlaxEngine;
namespace FlaxEditor.SceneGraph
{
/// <summary>
/// Helper class for actors with icon drawn in editor (eg. lights, probes, etc.).
/// </summary>
/// <seealso cref="ActorNode" />
[HideInEditor]
public abstract class ActorNodeWithIcon : ActorNode
{
/// <inheritdoc />
protected ActorNodeWithIcon(Actor actor)
: base(actor)
{
}
/// <inheritdoc />
public override bool RayCastSelf(ref RayCastData ray, out float distance, out Vector3 normal)
{
normal = Vector3.Up;
// Check if skip raycasts
if ((ray.Flags & RayCastData.FlagTypes.SkipEditorPrimitives) == RayCastData.FlagTypes.SkipEditorPrimitives)
{
distance = 0;
return false;
}
BoundingSphere sphere = new BoundingSphere(Transform.Translation, 7.0f);
return CollisionsHelper.RayIntersectsSphere(ref ray.Ray, ref sphere, out distance);
}
}
}