I am learning 3D with LWJGL and I’ve got some rendering done, but my question is how do I detect collisions? I’ve read about AABB but I think that only applies to stuff that’s on a fixed grid, but I want all of my shapes (cubes and such) to be moveable without a grid.
Well, unless you want to write your own physics engine (do not, and I mean DO NOT do this), you have to use physics engines. That is pretty much what they are for, if you aren’t using something like aabb. I would just use JBullet and be done with it.
AABB and things like it require the shapes to be A: cubes, and B: fixed to a grid.
That is a good link! Thanks! But if you are looking for something that is more precise, I would still suggest you use jbullet. That is a great resource though. +1
Sometimes, sometimes some libraries (actually most) have dependencies on other classes, so if you delete a class, others will stop working, even possibly the one you’re trying to use!
No, see, just using a physics engine because you can, is doing it wrong. Yes physics engines have collision checks but its a small part.
Do not use a physics engine just because you need collision checks.
Actually there are many many many many cases in which having a physics engine as opposed to just collision algorithm would make everything harder to code.
most games have “physics”, HOWEVER physics engines are mostly for games that want to replicate REAL physics(realistic games) or it is the main focus to play around with physics(angry birds)
we do SAT is one of our games
all of these OBB, AABB, rects, spheres or whatever work just fine without a grid
how often and when you do collision checks is important from the performance point of view
like having a grid and only check collisions among them, then do sphere checks first and only if thats true too, do real collision checks - something like that
I’m not sure yet, I was thinking something in the space or something.
I have another question which doesn’t really relate to this topic but, does anyone know what method Notch used for collision detecting in his 0x10c game? And which vecmath library?
I’ve searched all over the web trying to find that vecmath library, but with no luck sadly.
vecmath is a separate package aside Java SE. You can get it at java.net/projects/vecmath.
Also LWJGL provides a math library in [icode]lwjgl_util.jar[/icode]
If you’re a fresh developer, I wouldn’t advice you to start with something that huge as 0x10c (Please correct me if you’ve got some experience). I tried it myself, and while it got the basics of the room editor, it lacks so much. My point is that something like 0x10c is very hard because you have an 3D environment that is translatable, scalable and customizable by the user. That takes collision detecting to a whole new level for people who do not have great knowledge on that topic (if you choose to not use a collision/physics engine).
But if you want to try it, try it. You’ll learn a ton, but as said, it requires a lot of knowledge (I gave up on it just because the lack of experience).
+1 for Oskar, he’s a great teacher. I would also recommend theBennyBox, he has a whole series on building a 3D game engine from the ground up, and then creating a clone of some popular game that I just forgot the name of One of his latest episodes deals with collision detection, so you could probably take his collision detection theory and apply it in your game, as our engine is probably very different.