Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (494)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
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 detecting  (Read 837 times)
0 Members and 1 Guest are viewing this topic.
Offline Evenscio

Junior Newbie





« Posted 2013-09-28 17:20:58 »

Hi,

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.

Thanks!
Offline wessles

JGO Wizard


Medals: 66
Projects: 4
Exp: 3 years


Profile picture isn't relevant.


« Reply #1 - Posted 2013-09-28 17:23:22 »

Try out a physics engine. There are tons out there!
Here's just one!
And another (2d)!

Offline Evenscio

Junior Newbie





« Reply #2 - Posted 2013-09-28 17:39:31 »

I only need collision. If you could point me in the right direction (like AABB or so?) I'd be happy. Smiley
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline wessles

JGO Wizard


Medals: 66
Projects: 4
Exp: 3 years


Profile picture isn't relevant.


« Reply #3 - Posted 2013-09-28 18:49:14 »

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.

Relevant tutorial

Offline opiop65

JGO Kernel


Medals: 154
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #4 - Posted 2013-09-28 19:31:07 »

I've never actually done it myself, but this site looks good:
rocketmandevelopment.com/blog/separation-of-axis-theorem-for-collision-detection/

Offline wessles

JGO Wizard


Medals: 66
Projects: 4
Exp: 3 years


Profile picture isn't relevant.


« Reply #5 - Posted 2013-09-28 20:16:16 »

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

Offline opiop65

JGO Kernel


Medals: 154
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #6 - Posted 2013-09-28 20:20:05 »

Very true, a good physics library would work. I just wouldt like the extra "bloat" it would add from the unused classes!

Offline wessles

JGO Wizard


Medals: 66
Projects: 4
Exp: 3 years


Profile picture isn't relevant.


« Reply #7 - Posted 2013-09-28 20:39:03 »

That 'bloat' is delete able Smiley

Offline opiop65

JGO Kernel


Medals: 154
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #8 - Posted 2013-09-28 20:42:10 »

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!

Offline Cero
« Reply #9 - Posted 2013-09-28 22:35:25 »

I only need collision. If you could point me in the right direction (like AABB or so?) I'd be happy. Smiley

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.

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

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline relminator
« Reply #10 - Posted 2013-09-29 04:46:24 »

Hi,

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.

Thanks!

AABBs does not require them to be fixed on grids. You can move them as you like.

www.rel.phatcode.net/index.php?action=contents&item=Pyromax-Dax


Anyway, the choice of collision system depends on what type of game you're making.

What type of game are you making?
Offline Evenscio

Junior Newbie





« Reply #11 - Posted 2013-09-29 07:14:53 »

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.
Offline SHC
« Reply #12 - Posted 2013-09-29 07:52:25 »

@Evenscio

vecmath is a separate package aside Java SE. You can get it at java.net/projects/vecmath.
Also LWJGL provides a math library in
lwjgl_util.jar

Offline Simn
« Reply #13 - Posted 2013-09-29 10:54:57 »

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

- Simn
Offline Evenscio

Junior Newbie





« Reply #14 - Posted 2013-09-29 10:59:52 »

Well, I've programmed for over 7 years so I've got quite a bit of expierence.
Offline SHC
« Reply #15 - Posted 2013-09-29 11:03:29 »

@Evenscio

By fresh developer, Simn means fresh in game development. Also if you wanted to try, here's a tutorial I've found.

<a href="http://www.youtube.com/v/SVp_p19sX6M?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/SVp_p19sX6M?version=3&amp;hl=en_US&amp;start=</a>

It was made by Oskar Veerhoek and I recommend his full series if you are a complete beginner for 3D OpenGL.

Offline opiop65

JGO Kernel


Medals: 154
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #16 - Posted 2013-09-29 12:58:12 »

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

Offline SHC
« Reply #17 - Posted 2013-09-29 13:02:27 »

a clone of some popular game that I just forgot the name of...

It's Wolfenstein 3D.

Offline Evenscio

Junior Newbie





« Reply #18 - Posted 2013-09-29 17:31:29 »

Thanks for the link to thebennybox! I'm now following his tutorials and he explains it very well Smiley
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.

Dwinin (19 views)
2014-09-12 09:08:26

Norakomi (54 views)
2014-09-10 13:57:51

TehJavaDev (63 views)
2014-09-10 06:39:09

Tekkerue (31 views)
2014-09-09 02:24:56

mitcheeb (53 views)
2014-09-08 06:06:29

BurntPizza (37 views)
2014-09-07 01:13:42

Longarmx (23 views)
2014-09-07 01:12:14

Longarmx (27 views)
2014-09-07 01:11:22

Longarmx (27 views)
2014-09-07 01:10:19

mitcheeb (35 views)
2014-09-04 23:08:59
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!