Chapter 5.   When Worlds Collide [worlds colliding PIC]

 

An important physics-related gaming problem is how to handle object collisions. It can be difficult to decide how a 3D object should rebound or bounce, especially when mass, linear and angular velocity, gravity, friction, and other forces are taken into account.

The solution is to utilize a physics API, such as ODE to do the heavy-lifting for you. Create physics-based models of the objects, and let ODE calculate how they should move. Position and orientation details can be read from the models, and used to update the game's graphical entities.

Since I'm using Java, I'll actually utilize Odejava, a Java binding for ODE.

Odejava applications employ a dual-model approach, with (mostly) separate physics-based and graphical elements. I'll explain this approach in more detail with a simple example: balls bouncing off each other and the walls of a box. The screenshot above shows the Balls3D application in action.

This chapter is called "When Worlds Collide" because the balls are textured wrapped with images of the earth, the moon, and mars.

Problems downloading Odejava: January 2011. I've had a few people contact me about the non-availability of Odejava online. I'm as much in the dark about that as them. All I can suggest is to contact the main Odejava developer, Jani Laakso.

 

Downloads


Navigation:


Dr. Andrew Davison
E-mail: ad@fivedots.coe.psu.ac.th
Back to my home page