diff --git a/Source/Plugins/BuilderModes/Resources/Actions.cfg b/Source/Plugins/BuilderModes/Resources/Actions.cfg index fde04b11..987f7ef7 100755 --- a/Source/Plugins/BuilderModes/Resources/Actions.cfg +++ b/Source/Plugins/BuilderModes/Resources/Actions.cfg @@ -1444,4 +1444,14 @@ archbetweenhandles allowkeys = true; allowmouse = true; allowscroll = false; +} + +applycamerarotationtothings +{ + title = "Apply Camera Rotation To Things"; + category = "visual"; + description = "Applies the Visual Mode's current camera pitch and yaw to the selected things."; + allowkeys = true; + allowmouse = true; + allowscroll = false; } \ No newline at end of file diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs index 8381790c..d384bbd4 100755 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs @@ -4318,6 +4318,29 @@ namespace CodeImp.DoomBuilder.BuilderModes } } + /// + /// Applies the Visual Mode's current camera pitch and yaw to the selected things + /// + [BeginAction("applycamerarotationtothings")] + public void ApplyCameraRotationToThings() + { + List things = GetSelectedThings(); + + if(things.Count == 0) + { + General.Interface.DisplayStatus(StatusType.Warning, "Can't apply camera rotation to things: no things selected."); + return; + } + + General.Map.UndoRedo.CreateUndo("Apply camera rotation to things"); + + foreach (Thing t in things) + { + t.Rotate(General.Map.VisualCamera.AngleXY); + t.SetPitch((int)Angle2D.RadToDeg(-General.Map.VisualCamera.AngleZ)); + } + } + #endregion #region ================== Texture Alignment