Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (603)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (651)
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 problems using libgdx  (Read 1546 times)
0 Members and 1 Guest are viewing this topic.
Offline Ultroman

JGO Knight

Medals: 25
Projects: 1

Snappin' at snizzes since '83

« Posted 2013-01-17 18:31:35 »


I've successfully implemented the Box2D part of libgdx into my game, and it's working fine. Except that my bullets on rare occasion pass through my enemies. I handle all the collisions manually by getting the contactlist from the world, and iterate through them. I've set the body-property "bullet" to true on my bullet-entities, but it doesn't seem to make them update their collisions more vigorously and in smaller increments as intended.

What can I do? I would really like to avoid handling bullet-updates incrementally per update manually. Is there something I've missed?

- Jonas
Offline namrog84

JGO Ninja

Medals: 46
Projects: 4

Keep programming!

« Reply #1 - Posted 2013-01-17 18:37:44 »

are they passing through the enemies because they are moving 'too fast' ?  are they never actually colliding with the enemies? by making too big of movement steps per step?

sweep test?
add a collideable line between old position/new position of bullet?
make each world increment smaller steps, as to not 'jump' over a collideable enemy?

"Experience is what you get when you did not get what you wanted"
Offline Ultroman

JGO Knight

Medals: 25
Projects: 1

Snappin' at snizzes since '83

« Reply #2 - Posted 2013-01-19 01:01:18 »

Thanks for your reply, namrog84. Yeah, that's exactly it, and that's exactly the solution I'd love to get away from. I thought it might be handled in the framework already.

Is this really what we all have to do? The reason I implemented a physics engine, was so I could just fire-and-wait-for-contact. So I wouldn't have to handle all the movement manually, but could use a simple linear velocity instead Sad
Oh well, I already have a Java2D implementation of this. I guess I'll try to port that solution, if no one has any other suggestions.

- Jonas
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

SHC (11 views)
2015-08-01 03:58:20

Jesse (17 views)
2015-07-29 04:35:27

Riven (38 views)
2015-07-27 16:38:00

Riven (19 views)
2015-07-27 15:35:20

Riven (22 views)
2015-07-27 12:26:13

Riven (12 views)
2015-07-27 12:23:39

BurntPizza (32 views)
2015-07-25 00:14:37

BurntPizza (43 views)
2015-07-24 22:06:39

BurntPizza (25 views)
2015-07-24 06:06:53

NoxInc (31 views)
2015-07-22 22:16:53
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21 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!