Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/Engine/Core/Scene/SceneExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,24 @@ public static void FpsView(this Transform tc, float angleHorz, float angleVert,
tc.Rotation = new float3(angleVert, angleHorz, 0);
}

/// <summary>
/// This creates a shallow copy of this SceneNode with the abillity to be copied into a derived class. It does not connect the resullting copy with this SceneNodes parent.
/// </summary>
/// <typeparam name="TOut">Target type</typeparam>
/// <param name="sn"></param>
/// <returns></returns>
public static TOut ShallowCopy<TOut>(this SceneNode sn)
where TOut : SceneNode, new()
{
TOut tout = new TOut();

tout.Name = sn.Name;
tout.Components = sn.Components;
tout.Children = sn.Children;

return tout;
}

/// <summary>
/// Reference space for rotation.
/// </summary>
Expand Down