Преглед на файлове

Removed unnecesary Vector2f creation

grizeldi преди 9 години
родител
ревизия
b6b58660ab
променени са 1 файла, в които са добавени 3 реда и са изтрити 3 реда
  1. 3 3
      src/docs/asciidoc/jme3/beginner/hello_picking.adoc

+ 3 - 3
src/docs/asciidoc/jme3/beginner/hello_picking.adoc

@@ -331,11 +331,11 @@ The above example assumes that the player is aiming crosshairs (attached to the
 ----
 ...
 CollisionResults results = new CollisionResults();
-Vector2f click2d = inputManager.getCursorPosition();
+Vector2f click2d = inputManager.getCursorPosition().clone();
 Vector3f click3d = cam.getWorldCoordinates(
-    new Vector2f(click2d.x, click2d.y), 0f).clone();
+    click2d, 0f).clone();
 Vector3f dir = cam.getWorldCoordinates(
-    new Vector2f(click2d.x, click2d.y), 1f).subtractLocal(click3d).normalizeLocal();
+    click2d, 1f).subtractLocal(click3d).normalizeLocal();
 Ray ray = new Ray(click3d, dir);
 shootables.collideWith(ray, results);
 ...