Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
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 problem under extreme case.  (Read 2000 times)
0 Members and 1 Guest are viewing this topic.
Offline qxsl2000

Junior Newbie





« Posted 2012-04-30 09:30:09 »

hi, your guys.during my game-programming time  have been encountering problem, collision detection problem.
such as the following case , for example. given two game object,one for "ball" that has inconstant speed to act under the wall, one for "thin wall"(line) that is static object used to block that ball. one time,suddenly, once ball's speed approach to big cause collision detection failed,that is ball run across the wall instantly, above the wall. it's definitely wrong. Sad

such as the collision detection problem, how would you solve this. thank you.
Offline ReBirth
« Reply #1 - Posted 2012-04-30 11:27:11 »

Show us connection between your collision detection and game loop. When speed becomes big, it'll overlap detection which performed each frame call.

Offline qxsl2000

Junior Newbie





« Reply #2 - Posted 2012-04-30 12:36:27 »

sorry about that。i mean collision penetration。
 Smiley
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline theagentd
« Reply #3 - Posted 2012-04-30 12:49:47 »

Simple hack solution: Halve time step, double updates per seconds. =D

Myomyomyo.
Offline tom
« Reply #4 - Posted 2012-04-30 14:02:24 »

Clamp speed of ball so it don't move more than radius length each frame.

Offline ReBirth
« Reply #5 - Posted 2012-04-30 14:04:33 »

Predict it (but it's difficult).

Offline jonjava
« Reply #6 - Posted 2012-04-30 14:07:34 »

Why would it be difficult? Make a loop in the ball update that increments the balls radius until it reaches its destination - checking for collisions along the way.

Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #7 - Posted 2012-05-01 01:51:04 »

How about line collision? Make a line from the old location to the new location. If that line intersects anything in its path, backtrack the ball and make it collide Smiley

Offline qxsl2000

Junior Newbie





« Reply #8 - Posted 2012-05-01 04:35:06 »

How about line collision? Make a line from the old location to the new location. If that line intersects anything in its path, backtrack the ball and make it collide Smiley


yes,but if anything(walls) more than once along with the path.what which one is really contact first, how would you determine that?   Wink
Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #9 - Posted 2012-05-01 04:37:28 »

backtrack the ball, AKA bring the ball back to the original position and slowly move by its radius it until it hits something.

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

Junior Duke


Medals: 2



« Reply #10 - Posted 2012-05-01 12:56:01 »

Search 'swept' circle to line collisions...

https://www.google.co.uk/webhp?sourceid=chrome-instant&ix=seb&ie=UTF-8#hl=en&sclient=psy-ab&q=swept+circle+line+collision&oq=swept+circle+line+collision&aq=f&aqi=&aql=&gs_l=serp.3...195806.201583.0.201827.17.15.1.0.0.1.96.836.15.15.0...0.0.YsAR6aI1P34&pbx=1&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.,cf.osb&fp=42e46945646da5f5&ix=seb&biw=1394&bih=860


Consider all the collisions from t0 -> t1 and take the one that occurs first (this will be the line the circle hits first).
Offline qxsl2000

Junior Newbie





« Reply #11 - Posted 2012-05-03 05:34:07 »

 :)i think i got this. thank all you guys replying, also thank PaulCunningham guiding me the right way.
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 (38 views)
2014-10-17 03:59:02

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

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

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

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

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

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

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

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

BurntPizza (78 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!