results.getNumber() is already tested in the for loop. Probably not worth giving me commit privileges for this, so if someone would just apply the change for me . . .
Also, I may be completely out of my mind, but does this class basically do nothing right now? I can't find any outputs unless someone is parsing text later.
Index: src/jmetest/intersection/MousePick.java
===================================================================
— src/jmetest/intersection/MousePick.java (revision 5674)
+++ src/jmetest/intersection/MousePick.java (working copy)
@@ -43,6 +43,8 @@
import com.jme.scene.Text;
/**
-
- When the mouse button is pressed, casts a ray in the from the camera along its look vector, and logs struck objects
- When the mouse button is pressed, casts a ray in the from the camera along its look vector, and logs struck objects
-
- to the text constructor parameter.
* <code>MousePick</code>
* @author Mark Powell
* @version
@@ -77,14 +79,14 @@
hits += results.getNumber();
hitItems = "";
- if(results.getNumber() > 0) {
- for(int i = 0; i < results.getNumber(); i++) {
- hitItems += results.getPickData(i).getTargetMesh().getName() + " " + results.getPickData(i).getDistance();
- if(i != results.getNumber() -1) {
- hitItems += ", ";
- }
+
+ for(int i = 0; i < results.getNumber(); i++) {
+ hitItems += results.getPickData(i).getTargetMesh().getName() + " " + results.getPickData(i).getDistance();
+ if(i != results.getNumber() - 1) {
+ hitItems += ", ";
}
}
+
shots++;
results.clear();
text.print("Hits: " + hits + " Shots: " + shots + " : " + hitItems);
- to the text constructor parameter.