|
@@ -93,7 +93,8 @@ public class HelloPicking extends SimpleApplication {
|
|
// 2. Aim the ray from cam loc to cam direction.
|
|
// 2. Aim the ray from cam loc to cam direction.
|
|
Ray ray = new Ray(cam.getLocation(), cam.getDirection());
|
|
Ray ray = new Ray(cam.getLocation(), cam.getDirection());
|
|
// 3. Collect intersections between Ray and Shootables in results list.
|
|
// 3. Collect intersections between Ray and Shootables in results list.
|
|
- // DO NOT check collision with the root node, or else ALL collisions will hit the skybox! Always make a separate node for objects you want to collide with.
|
|
|
|
|
|
+ // DO NOT check collision with the root node, or else ALL collisions will hit the
|
|
|
|
+ // skybox! Always make a separate node for objects you want to collide with.
|
|
shootables.collideWith(ray, results);
|
|
shootables.collideWith(ray, results);
|
|
// 4. Print the results
|
|
// 4. Print the results
|
|
System.out.println("----- Collisions? " + results.size() + "-----");
|
|
System.out.println("----- Collisions? " + results.size() + "-----");
|
|
@@ -159,7 +160,8 @@ public class HelloPicking extends SimpleApplication {
|
|
ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
|
|
ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
|
|
ch.setText("+"); // crosshairs
|
|
ch.setText("+"); // crosshairs
|
|
ch.setLocalTranslation( // center
|
|
ch.setLocalTranslation( // center
|
|
- settings.getWidth() / 2 - ch.getLineWidth()/2, settings.getHeight() / 2 + ch.getLineHeight()/2, 0);
|
|
|
|
|
|
+ settings.getWidth() / 2 - ch.getLineWidth()/2,
|
|
|
|
+ settings.getHeight() / 2 + ch.getLineHeight()/2, 0);
|
|
guiNode.attachChild(ch);
|
|
guiNode.attachChild(ch);
|
|
}
|
|
}
|
|
|
|
|