Explorar o código

Fixed example scripts.

Lasse Öörni %!s(int64=13) %!d(string=hai) anos
pai
achega
4ea24a7a03
Modificáronse 3 ficheiros con 14 adicións e 12 borrados
  1. 1 1
      Bin/Data/Scripts/TestScene.as
  2. 10 10
      Bin/Data/Scripts/TestSceneOld.as
  3. 3 1
      Docs/GettingStarted.dox

+ 1 - 1
Bin/Data/Scripts/TestScene.as

@@ -465,7 +465,7 @@ void HandlePostRenderUpdate()
             testScene.debugRenderer.AddBoundingBox(BoundingBox(rayHitPos + Vector3(-0.01, -0.01, -0.01), rayHitPos +
                 Vector3(0.01, 0.01, 0.01)), Color(1.0, 1.0, 1.0), true);
 
-            if (input.keyPress['P'])
+            if (input.mouseButtonPress[MOUSEB_MIDDLE])
             {
                 DecalSet@ decal = result.drawable.node.GetComponent("DecalSet");
                 if (decal is null)

+ 10 - 10
Bin/Data/Scripts/TestSceneOld.as

@@ -554,18 +554,18 @@ void HandlePostRenderUpdate()
             Vector3 rayHitPos = cameraRay.origin + cameraRay.direction * result.distance;
             testScene.debugRenderer.AddBoundingBox(BoundingBox(rayHitPos + Vector3(-0.01, -0.01, -0.01), rayHitPos +
                 Vector3(0.01, 0.01, 0.01)), Color(1.0, 1.0, 1.0), true);
-        }
-        
-        if (input.keyPress['P'])
-        {
-            DecalSet@ decal = result.drawable.node.GetComponent("DecalSet");
-            if (decal is null)
+
+            if (input.mouseButtonPress[MOUSEB_MIDDLE])
             {
-                decal = result.drawable.node.CreateComponent("DecalSet");
-                decal.material = cache.GetResource("Material", "Materials/Test.xml");
+                DecalSet@ decal = result.drawable.node.GetComponent("DecalSet");
+                if (decal is null)
+                {
+                    decal = result.drawable.node.CreateComponent("DecalSet");
+                    decal.material = cache.GetResource("Material", "Materials/Test.xml");
+                }
+                decal.AddDecal(result.drawable, rayHitPos - cameraNode.worldRotation * Vector3(0, 0, 0.1), cameraNode.worldRotation, 0.1, 1.0, 0.2, Vector2(0, 0), Vector2(1, 1));
             }
-            decal.AddDecal(result.drawable, rayHitPos - cameraNode.worldRotation * Vector3(0, 0, 0.1), cameraNode.worldRotation, 0.1, 1.0, 0.2, Vector2(0, 0), Vector2(1, 1));
-        }        
+        }
     }
 }
 

+ 3 - 1
Docs/GettingStarted.dox

@@ -95,6 +95,7 @@ Key and mouse controls:
 WSAD        Move
 Left mouse  Create a new physics object; characters will ragdoll when hit
 Right mouse Hold and move mouse to rotate view
+Mid mouse   Paint a decal into the mouse cursor hit location
 Space       Toggle debug geometry
 F1          Toggle AngelScript console
 F5          Save scene
@@ -104,7 +105,8 @@ T           Toggle profiling display
 O           Toggle orthographic camera
 F           Toggle FXAA edge filter
 B           Toggle bloom post-process
-P           Paint a decal into the mouse cursor hit location
+P           Toggle scene animation (TestSceneOld only)
+L           Toggle camera light detached/attached (TestSceneOld only)
 \endverbatim
 
 TestScene also includes a network replication test, where clients can connect, move around as invisible cameras, and create new physics objects. For this, a server needs to be started with the command TestScene.bat server (-headless switch can optionally given so that the server will not open a graphics window) and clients can connect by specifying the server address on the command line, for example TestScene.bat 127.0.0.1