Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (481)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (548)
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 1070 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?

Thanks!
Offline arne

Senior Member




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

:: 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

Junior Member





« 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

http://java.sun.com/j2se/1.3/docs/api/java/awt/geom/Area.html

for(int i = 1; i > 0; i++)
{
System.out.println(i+" cups of java downed");
}
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

atombrot (27 views)
2014-08-19 09:29:53

Tekkerue (25 views)
2014-08-16 06:45:27

Tekkerue (23 views)
2014-08-16 06:22:17

Tekkerue (15 views)
2014-08-16 06:20:21

Tekkerue (22 views)
2014-08-16 06:12:11

Rayexar (61 views)
2014-08-11 02:49:23

BurntPizza (39 views)
2014-08-09 21:09:32

BurntPizza (31 views)
2014-08-08 02:01:56

Norakomi (37 views)
2014-08-06 19:49:38

BurntPizza (67 views)
2014-08-03 02:57:17
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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
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!