OSDN Git Service

Cleanup a bit
authorXoppa <contact@xoppa.nl>
Sun, 17 Feb 2013 00:26:51 +0000 (01:26 +0100)
committerXoppa <contact@xoppa.nl>
Sun, 17 Feb 2013 00:26:51 +0000 (01:26 +0100)
tests/gdx-tests/src/com/badlogic/gdx/tests/bullet/CollisionTest.java
tests/gdx-tests/src/com/badlogic/gdx/tests/bullet/ShootTest.java

index e8f862c..a0c2f14 100644 (file)
@@ -94,13 +94,14 @@ public class CollisionTest extends ShootTest {
                // See InternalTickTest on how to implement it.
                
                // Check what the projectile hits
-               if (projectile != null)
+               if (projectile != null) {
+                       color = projectile.color;
+                       projectile.color = Color.RED;
                        world.collisionWorld.contactTest(projectile.body, contactCB);
+               }
                // Check for other collisions
                updateContactInfo();
                
-               color = projectile.color;
-               projectile.color = Color.RED;
                if (hits.size > 0) {
                        for (int i = 0; i < hits.size; i++) {
                                colors.add(hits.get(i).color);
@@ -114,15 +115,12 @@ public class CollisionTest extends ShootTest {
                        }
                }
                render(false);
-               if (hits.size > 0) {
+               if (projectile != null)
                        projectile.color = color;
-                       for (int i = 0; i < hits.size; i++)
-                               hits.get(i).color = colors.get(i);
-               }
-               if (contacts.size > 0) {
-                       for (int i = 0; i < contacts.size; i++)
-                               contacts.get(i).color = colors.get(hits.size+i);
-               }
+               for (int i = 0; i < hits.size; i++)
+                       hits.get(i).color = colors.get(i);
+               for (int i = 0; i < contacts.size; i++)
+                       contacts.get(i).color = colors.get(hits.size+i);
        }
        
        @Override
index ad63206..fafacd6 100644 (file)
@@ -21,7 +21,6 @@ import com.badlogic.gdx.graphics.Mesh;
 import com.badlogic.gdx.graphics.VertexAttribute;
 import com.badlogic.gdx.graphics.VertexAttributes.Usage;
 import com.badlogic.gdx.math.collision.Ray;
-import com.badlogic.gdx.physics.bullet.btGhostObject;
 
 /** @author xoppa */
 public class ShootTest extends BaseBulletTest {