From 0d39eea2a671f867437247d82be883a319aa8537 Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Sun, 15 Aug 2021 22:08:46 -0400 Subject: [PATCH] Add "Set Rotation to Zero" Add a "Set Rotation to Zero" button in properties tab (Spatial section) of the create app. --- scripts/system/create/edit.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/system/create/edit.js b/scripts/system/create/edit.js index 614bd5fd59..727f8ca28d 100644 --- a/scripts/system/create/edit.js +++ b/scripts/system/create/edit.js @@ -2656,6 +2656,24 @@ var PropertiesTool = function (opts) { } else { audioFeedback.rejection(); } + } else if (data.action === "setRotationToZero") { + if (selectionManager.selections.length === 1 && SelectionManager.hasUnlockedSelection()) { + selectionManager.saveProperties(); + var parentState = getParentState(selectionManager.selections[0]); + if ((parentState === "PARENT_CHILDREN" || parentState === "CHILDREN") && selectionDisplay.getSpaceMode() === "local" ) { + Entities.editEntity(selectionManager.selections[0], { + localRotation: Quat.IDENTITY + }); + } else { + Entities.editEntity(selectionManager.selections[0], { + rotation: Quat.IDENTITY + }); + } + pushCommandForSelections(); + selectionManager._update(false, this); + } else { + audioFeedback.rejection(); + } } } else if (data.type === "propertiesPageReady") { updateSelections(true);