Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  odejava  (Read 1922 times)
0 Members and 1 Guest are viewing this topic.
Offline BMan

Senior Newbie

Java games rock!

« Posted 2005-06-27 14:42:50 »

Hello all,

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?  Smiley

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?

Offline arne

Senior Devvie

money is the worst drug- we should not let it rule

« Reply #1 - Posted 2005-06-27 15:16:02 »

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 ( ? 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.

:: JOODE :: Xith3d :: OdeJava ::
Offline BMan

Senior Newbie

Java games rock!

« Reply #2 - Posted 2005-06-27 21:59:34 »

Hmm, wow, the more I learn the less I seem to know Sad

So in the case of a simple Pong game, when I'm trying to get the collission of the ball and paddle, which
I thought I'd use a sphere and bounding box, is this what I should use?

Or is odejava more for complex physics where you let them physics control what everything is doing,
and you don't really have say in it (which is the point of physics based apps I know).

I am confused.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline weston
« Reply #3 - Posted 2005-06-28 06:21:11 »

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

for(int i = 1; i > 0; i++)
     System.out.println(i+" cups of java downed");
Pages: [1]
  ignore  |  Print  

EgonOlsen (77 views)
2018-06-10 19:43:48

EgonOlsen (57 views)
2018-06-10 19:43:44

EgonOlsen (77 views)
2018-06-10 19:43:20

DesertCoockie (259 views)
2018-05-13 18:23:11

nelsongames (157 views)
2018-04-24 18:15:36

nelsongames (156 views)
2018-04-24 18:14:32

ivj94 (897 views)
2018-03-24 14:47:39

ivj94 (161 views)
2018-03-24 14:46:31

ivj94 (810 views)
2018-03-24 14:43:53

Solater (174 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!