Browse Source

Alternative O key to create obstacles in the navigation demos. Closes #995.

Lasse Öörni 10 years ago
parent
commit
af985e0df1

+ 2 - 2
Source/Samples/15_Navigation/Navigation.cpp

@@ -181,7 +181,7 @@ void Navigation::CreateUI()
     instructionText->SetText(
     instructionText->SetText(
         "Use WASD keys to move, RMB to rotate view\n"
         "Use WASD keys to move, RMB to rotate view\n"
         "LMB to set destination, SHIFT+LMB to teleport\n"
         "LMB to set destination, SHIFT+LMB to teleport\n"
-        "MMB to add or remove obstacles\n"
+        "MMB or O key to add or remove obstacles\n"
         "Space to toggle debug geometry"
         "Space to toggle debug geometry"
     );
     );
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
@@ -256,7 +256,7 @@ void Navigation::MoveCamera(float timeStep)
     if (input->GetMouseButtonPress(MOUSEB_LEFT))
     if (input->GetMouseButtonPress(MOUSEB_LEFT))
         SetPathPoint();
         SetPathPoint();
     // Add or remove objects with middle mouse button, then rebuild navigation mesh partially
     // Add or remove objects with middle mouse button, then rebuild navigation mesh partially
-    if (input->GetMouseButtonPress(MOUSEB_MIDDLE))
+    if (input->GetMouseButtonPress(MOUSEB_MIDDLE) || input->GetKeyPress('O'))
         AddOrRemoveObject();
         AddOrRemoveObject();
 
 
     // Toggle debug geometry with space
     // Toggle debug geometry with space

+ 2 - 2
Source/Samples/39_CrowdNavigation/CrowdNavigation.cpp

@@ -208,7 +208,7 @@ void CrowdNavigation::CreateUI()
     instructionText->SetText(
     instructionText->SetText(
         "Use WASD keys to move, RMB to rotate view\n"
         "Use WASD keys to move, RMB to rotate view\n"
         "LMB to set destination, SHIFT+LMB to spawn a Jack\n"
         "LMB to set destination, SHIFT+LMB to spawn a Jack\n"
-        "MMB to add obstacles or remove obstacles/agents\n"
+        "MMB or O key to add obstacles or remove obstacles/agents\n"
         "F5 to save scene, F7 to load\n"
         "F5 to save scene, F7 to load\n"
         "Space to toggle debug geometry\n"
         "Space to toggle debug geometry\n"
         "F12 to toggle this instruction text"
         "F12 to toggle this instruction text"
@@ -443,7 +443,7 @@ void CrowdNavigation::MoveCamera(float timeStep)
     if (input->GetMouseButtonPress(MOUSEB_LEFT))
     if (input->GetMouseButtonPress(MOUSEB_LEFT))
         SetPathPoint(input->GetQualifierDown(QUAL_SHIFT));
         SetPathPoint(input->GetQualifierDown(QUAL_SHIFT));
     // Add new obstacle or remove existing obstacle/agent with middle mouse button
     // Add new obstacle or remove existing obstacle/agent with middle mouse button
-    else if (input->GetMouseButtonPress(MOUSEB_MIDDLE))
+    else if (input->GetMouseButtonPress(MOUSEB_MIDDLE) || input->GetKeyPress('O'))
         AddOrRemoveObject();
         AddOrRemoveObject();
 
 
     // Check for loading/saving the scene from/to the file Data/Scenes/CrowdNavigation.xml relative to the executable directory
     // Check for loading/saving the scene from/to the file Data/Scenes/CrowdNavigation.xml relative to the executable directory

+ 2 - 2
bin/Data/LuaScripts/15_Navigation.lua

@@ -131,7 +131,7 @@ function CreateUI()
     local instructionText = ui.root:CreateChild("Text")
     local instructionText = ui.root:CreateChild("Text")
     instructionText.text = "Use WASD keys to move, RMB to rotate view\n"..
     instructionText.text = "Use WASD keys to move, RMB to rotate view\n"..
         "LMB to set destination, SHIFT+LMB to teleport\n"..
         "LMB to set destination, SHIFT+LMB to teleport\n"..
-        "MMB to add or remove obstacles\n"..
+        "MMB or O key to add or remove obstacles\n"..
         "Space to toggle debug geometry"
         "Space to toggle debug geometry"
     instructionText:SetFont(cache:GetResource("Font", "Fonts/Anonymous Pro.ttf"), 15)
     instructionText:SetFont(cache:GetResource("Font", "Fonts/Anonymous Pro.ttf"), 15)
     -- The text has multiple rows. Center them in relation to each other
     -- The text has multiple rows. Center them in relation to each other
@@ -202,7 +202,7 @@ function MoveCamera(timeStep)
         SetPathPoint()
         SetPathPoint()
     end
     end
     -- Add or remove objects with middle mouse button, then rebuild navigation mesh partially
     -- Add or remove objects with middle mouse button, then rebuild navigation mesh partially
-    if input:GetMouseButtonPress(MOUSEB_MIDDLE) then
+    if input:GetMouseButtonPress(MOUSEB_MIDDLE) or input:GetKeyPress(KEY_O) then
         AddOrRemoveObject()
         AddOrRemoveObject()
     end
     end
     -- Toggle debug geometry with space
     -- Toggle debug geometry with space

+ 2 - 2
bin/Data/LuaScripts/39_CrowdNavigation.lua

@@ -152,7 +152,7 @@ function CreateUI()
     local instructionText = ui.root:CreateChild("Text", INSTRUCTION)
     local instructionText = ui.root:CreateChild("Text", INSTRUCTION)
     instructionText.text = "Use WASD keys to move, RMB to rotate view\n"..
     instructionText.text = "Use WASD keys to move, RMB to rotate view\n"..
         "LMB to set destination, SHIFT+LMB to spawn a Jack\n"..
         "LMB to set destination, SHIFT+LMB to spawn a Jack\n"..
-        "MMB to add obstacles or remove obstacles/agents\n"..
+        "MMB or O key to add obstacles or remove obstacles/agents\n"..
         "F5 to save scene, F7 to load\n"..
         "F5 to save scene, F7 to load\n"..
         "Space to toggle debug geometry\n"..
         "Space to toggle debug geometry\n"..
         "F12 to toggle this instruction text"
         "F12 to toggle this instruction text"
@@ -356,7 +356,7 @@ function MoveCamera(timeStep)
     if input:GetMouseButtonPress(MOUSEB_LEFT) then
     if input:GetMouseButtonPress(MOUSEB_LEFT) then
         SetPathPoint(input:GetQualifierDown(QUAL_SHIFT))
         SetPathPoint(input:GetQualifierDown(QUAL_SHIFT))
     -- Add new obstacle or remove existing obstacle/agent with middle mouse button
     -- Add new obstacle or remove existing obstacle/agent with middle mouse button
-    elseif input:GetMouseButtonPress(MOUSEB_MIDDLE) then
+    elseif input:GetMouseButtonPress(MOUSEB_MIDDLE) or input:GetKeyPress(KEY_O) then
         AddOrRemoveObject()
         AddOrRemoveObject()
     end
     end
 
 

+ 2 - 2
bin/Data/Scripts/15_Navigation.as

@@ -136,7 +136,7 @@ void CreateUI()
     instructionText.text =
     instructionText.text =
         "Use WASD keys to move, RMB to rotate view\n"
         "Use WASD keys to move, RMB to rotate view\n"
         "LMB to set destination, SHIFT+LMB to teleport\n"
         "LMB to set destination, SHIFT+LMB to teleport\n"
-        "MMB to add or remove obstacles\n"
+        "MMB or O key to add or remove obstacles\n"
         "Space to toggle debug geometry";
         "Space to toggle debug geometry";
     instructionText.SetFont(cache.GetResource("Font", "Fonts/Anonymous Pro.ttf"), 15);
     instructionText.SetFont(cache.GetResource("Font", "Fonts/Anonymous Pro.ttf"), 15);
     // The text has multiple rows. Center them in relation to each other
     // The text has multiple rows. Center them in relation to each other
@@ -206,7 +206,7 @@ void MoveCamera(float timeStep)
     if (input.mouseButtonPress[MOUSEB_LEFT])
     if (input.mouseButtonPress[MOUSEB_LEFT])
         SetPathPoint();
         SetPathPoint();
     // Add or remove objects with middle mouse button, then rebuild navigation mesh partially
     // Add or remove objects with middle mouse button, then rebuild navigation mesh partially
-    if (input.mouseButtonPress[MOUSEB_MIDDLE])
+    if (input.mouseButtonPress[MOUSEB_MIDDLE] || input.keyPress['O'])
         AddOrRemoveObject();
         AddOrRemoveObject();
 
 
     // Toggle debug geometry with space
     // Toggle debug geometry with space

+ 2 - 2
bin/Data/Scripts/39_CrowdNavigation.as

@@ -156,7 +156,7 @@ void CreateUI()
     instructionText.text =
     instructionText.text =
         "Use WASD keys to move, RMB to rotate view\n"
         "Use WASD keys to move, RMB to rotate view\n"
         "LMB to set destination, SHIFT+LMB to spawn a Jack\n"
         "LMB to set destination, SHIFT+LMB to spawn a Jack\n"
-        "MMB to add obstacles or remove obstacles/agents\n"
+        "MMB or O key to add obstacles or remove obstacles/agents\n"
         "F5 to save scene, F7 to load\n"
         "F5 to save scene, F7 to load\n"
         "Space to toggle debug geometry\n"
         "Space to toggle debug geometry\n"
         "F12 to toggle this instruction text";
         "F12 to toggle this instruction text";
@@ -378,7 +378,7 @@ void MoveCamera(float timeStep)
     if (input.mouseButtonPress[MOUSEB_LEFT])
     if (input.mouseButtonPress[MOUSEB_LEFT])
         SetPathPoint(input.qualifierDown[QUAL_SHIFT]);
         SetPathPoint(input.qualifierDown[QUAL_SHIFT]);
     // Add new obstacle or remove existing obstacle/agent with middle mouse button
     // Add new obstacle or remove existing obstacle/agent with middle mouse button
-    else if (input.mouseButtonPress[MOUSEB_MIDDLE])
+    else if (input.mouseButtonPress[MOUSEB_MIDDLE] || input.keyPress['O'])
         AddOrRemoveObject();
         AddOrRemoveObject();
 
 
     // Check for loading/saving the scene from/to the file Data/Scenes/CrowdNavigation.xml relative to the executable directory
     // Check for loading/saving the scene from/to the file Data/Scenes/CrowdNavigation.xml relative to the executable directory