Improve focusing on selected object in Editor

#328
This commit is contained in:
Wojtek Figat
2021-03-18 22:20:27 +01:00
parent 255b2c85c8
commit 4ae3fccfd9
5 changed files with 53 additions and 31 deletions

View File

@@ -309,6 +309,20 @@ namespace FlaxEditor.SceneGraph
return false;
}
/// <summary>
/// Gets the object bounding sphere (including child actors).
/// </summary>
/// <param name="sphere">The bounding sphere.</param>
public virtual void GetEditorSphere(out BoundingSphere sphere)
{
sphere = new BoundingSphere(Transform.Translation, 15.0f);
for (int i = 0; i < ChildNodes.Count; i++)
{
ChildNodes[i].GetEditorSphere(out var childSphere);
BoundingSphere.Merge(ref sphere, ref childSphere, out sphere);
}
}
/// <summary>
/// Called when selected nodes should draw debug shapes using <see cref="DebugDraw"/> interface.
/// </summary>