Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (416)
games submitted by our members
Games in WIP (306)
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  
  [UNSOLVED] Detecting Collision between a polygon and a circle? PRECISE  (Read 403 times)
0 Members and 1 Guest are viewing this topic.
Offline wreed12345
« Posted 2012-12-11 23:19:14 »

I have posted this before but what the results were are not as accurate as I need them to be. I have two images
A snow ball,
Circle centered in a square image
And a character

thats not my exact character but something like that.

Now I need precise detection between the two. I cant just detect if the two images hit each other beacause the character does not always hit the edge of the image therefore making that type of detection inaccurate.

Im really confused....how do i do this?Huh
Offline cheatsguy

Junior Member


Medals: 3


Gamer turned Pixel Artist turned Programmer


« Reply #1 - Posted 2012-12-11 23:35:17 »

You'll want to use pixel perfect collision if it absolutely HAS to be perfect, but a square will likely work just as well if you have a character with proportions similar to that, just make the actual radius of the snowball smaller than the image or make it have a delay before disappearing/falling apart

Busy between school, work, life, games, programming and general screwing around.
If you'd like some pixel art for your game, send me a PM, i'll see what I can do.
Current project: http://elementalwarblog.wordpress.com/
Offline wreed12345
« Reply #2 - Posted 2012-12-11 23:44:07 »

the detection has to be pixel perfect. the images dont fill the square enough to make it work otherwise.. how would i implement sometihng like this
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Mac70
« Reply #3 - Posted 2012-12-12 00:58:21 »

What graphics library do you use? I can give you answer for LWJGL.
Offline wreed12345
« Reply #4 - Posted 2012-12-12 01:02:21 »

im coding eveything myself for an android app no lwjgl Sad
Offline Abuse

JGO Coder


Medals: 2


falling into the abyss of reality


« Reply #5 - Posted 2012-12-12 01:50:45 »

Is the polygon (character), or circle (snowball) moving?

If so, for precise collision detect you'll need to consider the collision as a swept circle <-> polygon interaction.

Google points me to this: http://www.three14.demon.nl/sweptellipsoid/SweptEllipsoid.pdf

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline wreed12345
« Reply #6 - Posted 2012-12-12 02:20:41 »

both objects are moving... and that website looks a little too complex for my understanding
Offline cheatsguy

Junior Member


Medals: 3


Gamer turned Pixel Artist turned Programmer


« Reply #7 - Posted 2012-12-12 03:55:45 »

Just thought of this, perhaps you could make something similar to hitboxes used in 3D games to fit without needing the headache that is pixel-perfect and speed up the whole process. No clue how to do this though :/

Busy between school, work, life, games, programming and general screwing around.
If you'd like some pixel art for your game, send me a PM, i'll see what I can do.
Current project: http://elementalwarblog.wordpress.com/
Offline wreed12345
« Reply #8 - Posted 2012-12-12 04:28:25 »

I'm not sure what you mean, but write now I have a detection of when the two images close, although it is not as accurate as I need it to be:(
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
Jesse_Attard (10 views)
2013-06-18 13:03:02

HeroesGraveDev (55 views)
2013-06-15 14:35:23

Vermeer (55 views)
2013-06-14 11:08:06

davedes (54 views)
2013-06-14 07:03:55

alaslipknot (50 views)
2013-06-12 22:56:31

Roquen (67 views)
2013-06-11 19:12:32

alaslipknot (56 views)
2013-06-10 10:30:18

HeroesGraveDev (72 views)
2013-06-08 19:36:03

alaslipknot (60 views)
2013-06-08 18:40:19

CodeHead (60 views)
2013-06-08 17:55:41
Smoothing Algorithm Question
by UprightPath
2013-05-27 17:58:26

Smoothing Algorithm Question
by UprightPath
2013-05-27 17:57:33

Complex number cookbook
by Roquen
2013-04-24 03:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 07:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 07:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 07:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 08:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 07:17:38
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!