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 detection problems using libgdx  (Read 1238 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 »

Hi.

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.

 

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!