I've been reading around about collision detection, and it seems like most folks are starting to use odejava for theirs.

I've looked at the site and downloaded it, and think I got it installed, but now not sure where to go. It does not seem like there are any good tutorials or examples of just a simple collision detection in java with odejava.

Might anyone have a simple "sphere moves left to right and hits cube and signals" type of example handy?

If not, what would be a good place to start with this?

Or is this even the way to go? Is there a better way to do collision detection?

First of all what you have to understand about odejava is, odejava is using forces. So you don't say sphere moves against wall and tell me when it hits - no you add a force to the sphere that makes it move in the direction of the wall and when it collides it's "pushed" back from the wall.

I don't know some good tutorials, but what about looking into the javadoc and in the sourcecode of some of the examples already contained in the odejava-xith3d package (src.org.odejava.xith3d.test) ? Ofcourse you will have to have xith3d installed for them to get running. But the main stuff is actually the same, it's only the linking to a rendering scenegraph thats different.

ODE is for physical simulations. Although you probably could use it for a simple pong game, it would be extreme overkill. You want to use ode for things like ragdoll behavior, vehicles, or objects bouncing around in 3d space. For a simple pong game it would be much easier to do some basic math to check for a collision and then modify the ball's velocity on impact. Since your ball is a circular, you can just check if the distance from the paddle to the center of your ball is less than the ball's radius, if it is then reverse the velocity (you may want to do more than reverse it, but the change will take place here regardless).

Another commom method for doing collision detection in simple games is to use java.awt.geom.Area. If you choose this method, you will constructs Areas to represent the shapes of your various game objects. Once each game object has an Area representation, you can use methods in the Area class to check for intersections among each of the potentially colliding game objects. This will only let you know than an intersection occurs, it will not tell you how the objects should respond to the collision

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org