Commit 4c3d44f5 authored by Timothy  Borunov's avatar Timothy Borunov
Browse files

Fixed bug in collisions where z axis was not being correctly checked

parent c9518fd5
Loading
Loading
Loading
Loading
+1 −16
Original line number Diff line number Diff line
@@ -66,18 +66,9 @@ public class GraphicsAndWindowsTest extends Application {
        objects[3] = newObject4;


        //--image src/teapot.txt --speed 10 --dir 8, 4, 10

        // Create a Translate transform
        // Set the translation values
        //newObject1.setTranslate(sceneWindow.getXOffset(), sceneWindow.getYOffset(),0);
        //newObject2.setTranslate(sceneWindow.getXOffset(), sceneWindow.getYOffset(),0);
        //newObject3.setTranslate(sceneWindow.getXOffset(), sceneWindow.getYOffset(),0);

        Group group3D = new Group(); // Group of our 3D elements
        for (MovingObject o : objects ) {
            o.setTranslate(sceneWindow.getXOffset(), sceneWindow.getYOffset(),0);
            //o.setTranslate(0, 0,0);
            group3D.getChildren().add(o.getMesh());
        }

@@ -189,12 +180,6 @@ public class GraphicsAndWindowsTest extends Application {
                    direction[i] = objects[i].getVelocityVec();
                }

//                double minX = meshBounds.getMinX() + direction1[0];
//                double maxX = meshBounds.getMaxX() + direction1[0];
//                double minY = meshBounds.getMinY() + direction1[1];
//                double maxY = meshBounds.getMaxY() + direction1[1];
//                double minZ = meshBounds.getMinZ() + direction1[2];
//                double maxZ = meshBounds.getMaxZ() + direction1[2];
                //Number is roughly 1 mill divided by 60
                if (now - lastUpdate >= 16_000_000) { // Roughly 60 frames per second

@@ -243,7 +228,7 @@ public class GraphicsAndWindowsTest extends Application {
                            lastChanged = 2;
                            //mesh.getPoints().setAll(points);
                        }
                        if (meshBounds[i].getMinZ() + direction[i][2] < 0 || meshBounds[i].getMinZ() + direction[i][2] > WindowSize) {
                        if (meshBounds[i].getMinZ() + direction[i][2] < 0 || meshBounds[i].getMaxZ() + direction[i][2] > WindowSize) {

                            // load the vertices of the mesh
                            //float[] points = mesh.getPoints().toArray(null);