At the moment I have a terrain with a cube in it with a view collider based on David Yazels Movement class from his Quake3Loader classes and demo.
I want to return a String (using println) to say they have collided when they do. All the collision stuff works fine, I just want to return something when the collision happens between the view and cube.
My current effort revolves around using Bounding objects. In the code below viewBounds is a BoundingSphere and cube1Bounds is a BoundingBox. I've put it in the render loop so it's checked each render.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| public void runTest() { long startTime = -1;
while (true) { if (viewBounds.intersect(cube1Bounds) == true) { System.out.println("collision"); } . . . . } |
At the moment it just returns the string regardless of if the Bounding objects intersect. Am I going in the right direction with this?
Does a better way to do this occur in the collision packages, do I need to to check this intersect somewhere else or I am just using faulty logic?
Thanks.