diff --git a/scripts/vr-edit/modules/selection.js b/scripts/vr-edit/modules/selection.js index 9836a1fed6..2b1e7e5a37 100644 --- a/scripts/vr-edit/modules/selection.js +++ b/scripts/vr-edit/modules/selection.js @@ -365,6 +365,10 @@ Selection = function (side) { return properties.color; } + function applyPhysics() { + // TODO + } + function clear() { selection = []; selectedEntityID = null; @@ -401,6 +405,7 @@ Selection = function (side) { cloneEntities: cloneEntities, applyColor: applyColor, getColor: getColor, + applyPhysics: applyPhysics, deleteEntities: deleteEntities, clear: clear, destroy: destroy diff --git a/scripts/vr-edit/modules/toolIcon.js b/scripts/vr-edit/modules/toolIcon.js index a223fdb923..6ff748ac59 100644 --- a/scripts/vr-edit/modules/toolIcon.js +++ b/scripts/vr-edit/modules/toolIcon.js @@ -20,7 +20,8 @@ ToolIcon = function (side) { GROUP_TOOL = 2, COLOR_TOOL = 3, PICK_COLOR_TOOL = 4, - DELETE_TOOL = 5, + PHYSICS_TOOL = 5, + DELETE_TOOL = 6, ICON_COLORS = [ { red: 0, green: 240, blue: 240 }, @@ -28,6 +29,7 @@ ToolIcon = function (side) { { red: 220, green: 60, blue: 220 }, { red: 220, green: 220, blue: 220 }, { red: 0, green: 0, blue: 0 }, + { red: 60, green: 60, blue: 240 }, { red: 240, green: 60, blue: 60 } ], @@ -114,6 +116,7 @@ ToolIcon = function (side) { GROUP_TOOL: GROUP_TOOL, COLOR_TOOL: COLOR_TOOL, PICK_COLOR_TOOL: PICK_COLOR_TOOL, + PHYSICS_TOOL: PHYSICS_TOOL, DELETE_TOOL: DELETE_TOOL, setHand: setHand, update: update, diff --git a/scripts/vr-edit/modules/toolMenu.js b/scripts/vr-edit/modules/toolMenu.js index 65647740fd..a90cb4f17c 100644 --- a/scripts/vr-edit/modules/toolMenu.js +++ b/scripts/vr-edit/modules/toolMenu.js @@ -126,6 +126,18 @@ ToolMenu = function (side, leftInputs, rightInputs, uiCommandCallback) { ignoreRayIntersection: true, visible: true } + }, + "slider": { + overlay: "cube", + properties: { + dimensions: { x: 0.03, y: 0.1, z: 0.01 }, + localRotation: Quat.ZERO, + color: { red: 128, green: 128, blue: 255 }, + alpha: 0.1, + solid: true, + ignoreRayIntersection: false, + visible: true + } } }, @@ -298,6 +310,16 @@ ToolMenu = function (side, leftInputs, rightInputs, uiCommandCallback) { properties: { localPosition: { x: 0.055, y: 0.0, z: -0.005 } } + }, + { + id: "physicsSlider", + type: "slider", + properties: { + localPosition: { x: -0.02, y: 0.0, z: -0.005 } + }, + callback: { + method: "setSliderValue" + } } ] }, diff --git a/scripts/vr-edit/vr-edit.js b/scripts/vr-edit/vr-edit.js index baea506446..7b93fd98b3 100644 --- a/scripts/vr-edit/vr-edit.js +++ b/scripts/vr-edit/vr-edit.js @@ -28,7 +28,8 @@ TOOL_GROUP = 3, TOOL_COLOR = 4, TOOL_PICK_COLOR = 5, - TOOL_DELETE = 6, + TOOL_PHYSICS = 6, + TOOL_DELETE = 7, toolSelected = TOOL_NONE, colorToolColor = { red: 128, green: 128, blue: 128 }, @@ -283,6 +284,7 @@ GROUP_TOOL: toolIcon.GROUP_TOOL, COLOR_TOOL: toolIcon.COLOR_TOOL, PICK_COLOR_TOOL: toolIcon.PICK_COLOR_TOOL, + PHYSICS_TOOL: toolIcon.PHYSICS_TOOL, DELETE_TOOL: toolIcon.DELETE_TOOL, display: display, updateUIEntities: setUIEntities, @@ -882,6 +884,8 @@ toolSelected = TOOL_COLOR; ui.setToolIcon(ui.COLOR_TOOL); ui.setToolColor(colorToolColor); + } else if (toolSelected === TOOL_PHYSICS) { + selection.applyPhysics(); } else if (toolSelected === TOOL_DELETE) { setState(EDITOR_HIGHLIGHTING); selection.deleteEntities(); @@ -949,6 +953,8 @@ toolSelected = TOOL_COLOR; ui.setToolIcon(ui.COLOR_TOOL); ui.setToolColor(colorToolColor); + } else if (toolSelected === TOOL_PHYSICS) { + selection.applyPhysics(); } else if (toolSelected === TOOL_DELETE) { selection.deleteEntities(); setState(EDITOR_SEARCHING); @@ -1308,6 +1314,11 @@ ui.setToolIcon(ui.PICK_COLOR_TOOL); ui.updateUIEntities(); break; + case "physicsTool": + toolSelected = TOOL_PHYSICS; + ui.setToolIcon(ui.PHYSICS_TOOL); + ui.updateUIEntities(); + break; case "deleteTool": grouping.clear(); toolSelected = TOOL_DELETE; @@ -1332,8 +1343,11 @@ editors[LEFT_HAND].enableAutoGrab(); editors[RIGHT_HAND].enableAutoGrab(); break; + case "setSliderValue": + print("$$$$$$$ setSliderValue = " + JSON.stringify(parameter)); + break; default: - debug("ERROR: Unexpected command in onUICommand()!"); + debug("ERROR: Unexpected command in onUICommand()! " + command); } }