Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (512)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
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  
  Collision Detection Libraries  (Read 2997 times)
0 Members and 1 Guest are viewing this topic.
Offline dsellars

Junior Duke




Need to write more games


« Posted 2004-07-29 10:34:07 »

Hello,

Does any one know of any collision detection libraries written in java?  I would like to be able to perform OOB, AABB and ray intersections, at the moment I'm not too interested in going down to the individual triangle level in a model.

I would like to be able to do this independently of a rendering engine (I know that Java3D has some of these abilities) I would also not want to rely on native code ala odejava.

I've had a look around and there seem to be few of different libraries in C++ (opcode, RAPID, I-Collide etc.)  I just wondered if anyone had written (or ported) a similar library in java.

I would attempt to have a go myself, but knowing nothing about the intricasies of collision detection and also feeling that someone must have faced this problem before I thought I'd ask here.

Cheers,
Dan.


Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #1 - Posted 2004-07-29 23:22:06 »

Odejava uses ODE which uses OPCODE.  It's not "ported" to Java, we just use a wrapper to the native library (which means less work keeping the ported version current).

To use it - use the Space and Geom objects and ignore World and Body (the latter being for physics simulation).

Xith3D also has a collision API but I have not used it and apparently it is  currently broken.

Will.

Online kevglass

JGO Kernel


Medals: 186
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #2 - Posted 2004-07-30 04:42:44 »

Hey, this looks pretty good, might port it to Java?

http://photoneffect.com/coldet/

EDIT: Looking through the C++ the code actually looks really tidy too Smiley

Kev

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #3 - Posted 2004-07-30 06:56:51 »

it does look good - although it's LGPL which isn't the best license for use in Java programs.

Will.

Online kevglass

JGO Kernel


Medals: 186
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #4 - Posted 2004-07-30 07:24:02 »

Futher investigation shows it could do we a bit of refactoring. However, how would LGPL impact us?

Kev

Offline Jacko

Junior Duke





« Reply #5 - Posted 2004-07-30 17:21:08 »

Have a look at http://www.cs.ubc.ca/spider/lloyd/java/vclip.html.

Its a Java implementation of Mirtich's V-Clip algorithm that you've probably seen the C++ version of. Not sure how well it works though.

If you wanted to get into writing your own java collision detection routines then I have heard good things about  "Collision Detection in Interactive 3D Environments" which is by the guy who wrote SOLID.

Paul
Offline dsellars

Junior Duke




Need to write more games


« Reply #6 - Posted 2004-08-01 09:30:43 »

Thank you all for your replies.  I've been with out access to the forums since I posted the question so havn't had time to reply yet.

wrt odejava using it to just do collision was one of my first ideas.  Unfortunatly (and I could weel be wrong here) I got the impression that it was would work well to do a give me a list of everything that collides now (what you want for the physics aspect).  But trying to do a one off query like  "what does this interesct with" ie picking or line of sight would not be so easy.  Is this assumption correct?  I aslo had a problem with it crashing when I tried to remove an object from a space but I think that may have been sorted now.   Does odejava/ode's implementation of opcode automatically partition the space into a AABB? or should you decide the partition with spaces yourself?  if it does partition how does it deal with movign objects?  

wrt to coldet I have come across this before in my searching but from other forums (flipcode I think) I got eh impression that it wasn't so good, plus I'm not sure that it has been updated in a few years.  Having said that updates to opcode are going to be diffucult now as Pierre Terdiman now works for novadex.

wrt v-clip I've hread of it but didn't realise that someone had implemented it in java, I'll go and take a closer look.  As for the book it's a shame ordering off amazon is so easy now....  I'm going to be in trouble when it arrives Wink

Any one have any more thoughts?  thanks again,
Dan.      
Offline epotash

Senior Newbie




Java games rock!


« Reply #7 - Posted 2004-08-05 14:50:19 »

i always like the source code on david elberlys site: www.magic-software.com, go to Source Code -> Intersection, he has some good stuff...

Btw, i am in the process of writing a rigid body physics engine in java using jogl for rendering and I have implemented collision detection and intersection tests with spheres, boxes, and triangle arrays.

P.S.: the magic-software source code is well structured but as a java programmer i found his naming conventions kind of annoying, he uses a lot of prefixes and suffixes, but once u understand them its easy to read.
Offline dsellars

Junior Duke




Need to write more games


« Reply #8 - Posted 2004-08-06 06:34:09 »

Thanks,

I have actually seen his site and your right it's got alot of good info in it.  

At the moment I'm reading the book suggested above but my maths is a little rusty Wink So it's fun, but very challenging.  Wether it will ever translatin into a Collision lib I doubt (even just a personal one) but I'll see how I go, it would be a nice challange but most probably too demanding.

How's your physics engine comming along?  it sounds tempting Wink   Is it bespoke or based on somthing like ode? IMHO a pure java physics engine would be very good to see.*

Cheers again,

Dan.


* I'm not disparaging odejava or all the good work that has been done on it, I think it's a very valubale project Smiley
Offline epotash

Senior Newbie




Java games rock!


« Reply #9 - Posted 2004-08-07 20:33:55 »

well, right now im still working on tri-tri collision detection... but its not really necessary for some initial demos.

basically right now its just a very nice framework with collision detection and response implemented.  what i think is really cool about it is that its very modular and very extendable.  like i have an interface SceneGraph that anyone can implement to do any kind of optimizations for culling or collision detection that they want.  and all the UI stuff will still work really simply.  the intersection/collision tests are not part of the scenegraph but part of the Geometry library and can be called completely separately.

so i still have a ways to go for a full featured physics engine.  i need to do friction and resting contact next. and then, if i ever get to it, joints.  the end goal is a car physics, which i find really cool.

btw, im sorry, but i really hate the idea of using that java binding for ode.  why not license the unreal engine and do a java binding for that?

anyway, what do u think would be a good name for my engine.  i recently thought of Absorb, which loosely stands for A Beautiful Simulation of Rigid Bodies, and also just sounds decent.  but for now its unamed, and the package is called simply "engine"

Im gonna try to work hard in the near future to get a nice demo of the engine (maybe a couple)... thats really my goal.  my dream, really the reason i started looking into building an engine, is car physics.

i probably will stop tri-tri collisions and just do some stuff with boxes and spheres, get some friction and contact going.  after that get collision done.  then maybe improve my integration techniques.  then maybe some particle stuff.  somewhere along the way ill get to adding some lighting to the scene graph.  then other effects like fog, multi-texturing, shaders, bump-mapping...
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #10 - Posted 2004-08-08 21:26:05 »

Quote

btw, im sorry, but i really hate the idea of using that java binding for ode.  why not license the unreal engine and do a java binding for that?


Care to explain why?  Perhaps the next time I've got a spare  US$350,000, an unreal binding would be fun, but until then I think I'll stick with free as in beer engines.

Sounds like you are re-inventing the wheel creating yet another physics engine/scenegraph combination. I guess you must be doing it for the coding experience or is there some deficiency in what is currently available?

Will.

Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #11 - Posted 2004-08-08 21:40:41 »

Quote
Futher investigation shows it could do we a bit of refactoring. However, how would LGPL impact us?

Kev


Well there's a lot of confusion with how the LGPL applies to Java.  There's been some talk in these forums on this and a slashdot story at one stage.  *GPL was designed from a narrow minded C-centric point of view which may cause problems.  A google search provides more detail, there is one java weblog on the topic

Based on this confusion, I try and avoid using LGPL code as integral parts of my projects.  Peripheral things like sound is ok, but I would hesitate basing a whole engine on it.  ODE fortunately is licensed under a BSD-like license.  Apparently (according to the update on the slashdot story) it *is* ok to use the LGPL with java but whatever way you look at it, there is an added risk in doing so.

Will.

Offline epotash

Senior Newbie




Java games rock!


« Reply #12 - Posted 2004-08-10 21:24:11 »

i am sorry, i was a bit harsh, and you are probably right.  i am doing this entirely because i love physics and java.  i guess if the goal is to focus on developing a real game, then using a binding of ode is cool.

but, if there was a physics engine written entirely in java that had support for the same features as ode, would you use it over ode?

anyway, what are most of the people in here actually doing with like lwjgl or xith3d or j3d? are they writing games? if they are trying to actually create a full game, then i guess by using another library they are saving themselves a lot of time.

ive looked at ode a couple of times, its pretty cool.  does it support any liquid dynamics?

also, i was wondering, by using a separate library for physics stuff, dont u have to store all of your geometry information twice?  does that affect performance at all? or can you do something cool with pointers to get around that?

--eric
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #13 - Posted 2004-08-10 23:24:37 »

Quote
i am sorry, i was a bit harsh, and you are probably right.  i am doing this entirely because i love physics and java.  i guess if the goal is to focus on developing a real game, then using a binding of ode is cool.

but, if there was a physics engine written entirely in java that had support for the same features as ode, would you use it over ode?


Yes I would use it.

There has been talk of porting ODE to Java, however it is a large upfront effort and requires an ongoing commitment to ensure the port doesn't get out of date.  This commitment is quite large and would take up a lot of time which otherwise could be spent making a game.

For me now, any engine would have to be fairly ODE compatible as I have invested a lot of time defining an XML file format (XODE) and creating my game objects using that.

Quote

anyway, what are most of the people in here actually doing with like lwjgl or xith3d or j3d? are they writing games? if they are trying to actually create a full game, then i guess by using another library they are saving themselves a lot of time.


most people are I think

Quote

ive looked at ode a couple of times, its pretty cool.  does it support any liquid dynamics?


not that I know of

Quote

also, i was wondering, by using a separate library for physics stuff, dont u have to store all of your geometry information twice?  does that affect performance at all? or can you do something cool with pointers to get around that?


There is some info that is stored twice, but not a lot.  For example my display (Xith3D) engine has a several thousand polygon tank mesh to represent the tank while my physics engine (Odejava) has three rectangular boxes to approximate the tank (hull, turret and gun).  While I could use a TriMesh and have exact collision, there is little need - three boxes gives me a very good approximation as it is.  For the terrain however, yes the information is stored twice plain and simple.

Will.

Offline epotash

Senior Newbie




Java games rock!


« Reply #14 - Posted 2004-08-11 02:32:23 »

i dont really read these forums much, but u sound like a pretty serious contributor.   your tank project seems pretty cool, do u have any screenshots?
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.

Longarmx (50 views)
2014-10-17 03:59:02

Norakomi (39 views)
2014-10-16 15:22:06

Norakomi (31 views)
2014-10-16 15:20:20

lcass (35 views)
2014-10-15 16:18:58

TehJavaDev (66 views)
2014-10-14 00:39:48

TehJavaDev (65 views)
2014-10-14 00:35:47

TehJavaDev (55 views)
2014-10-14 00:32:37

BurntPizza (72 views)
2014-10-11 23:24:42

BurntPizza (43 views)
2014-10-11 23:10:45

BurntPizza (84 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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