Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (526)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (593)
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 on diagonal planes  (Read 1714 times)
0 Members and 1 Guest are viewing this topic.
Offline Serethos

Junior Devvie




Java games rock!


« Posted 2005-01-09 12:57:08 »

im thinking about a proper way of adding to my arkanoid game some not  only rectangle like bricks. so it should be possible (like in a flipper) to have diagonal collision, e.g. if a brick is hexagonal or turned with 30°.

the only way to do proper collision detection i see is to calculate (or perhaps better store) the normal of each side of the object.

i only want to go sure tehres no better way ...
Offline KONI

Junior Devvie




Java games rock!


« Reply #1 - Posted 2005-01-09 15:09:38 »

in my demo of "destructible terrain" in the java2d forum, I was using the following method:

- check for collision
- normalize the speed vector
- backtrace the trajectory until exact collision point found
- do an approximation on the angle of the surface:
calculate dy/dx of a small surface, like from collision point - 2 to collision point + 2. On cp + 2 and cp - 2, we always go up or down to find the exact surface point (up if inside object and down if outside object). this gives you the surface angle

I know this method isn't perfect but worked great in our case. There could be some errors on extreme situations where you hit the edge of something.
Offline tom
« Reply #2 - Posted 2005-01-09 16:43:08 »

Asuming the ball is round, the collision normal is always (center of ball)  -  (exact point of collison between ball and wall).

But to get the point of collision you may need to store the normals of the bricks. Depends on how you do your collisions.

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

Junior Devvie




Java games rock!


« Reply #3 - Posted 2005-01-10 18:30:32 »

im still in my planning phase, so some thought may be unfinished.
if all bricks were standard rectangles i needed only to test if the point on which the direction*speed vector is pointing lies within the bounding box.

now for the polygons. tom, you got a main problem:
even if i store all normales for each plane i additionally need to know the exact intersection point.
i only know one way to test this, to calculate the intersection of both lines (the one is the plane itself, the other is the line following the ball's direction vector).
but line intersection is pretty expensive so i want to consider all possible methods before using them ...
Offline KONI

Junior Devvie




Java games rock!


« Reply #4 - Posted 2005-01-10 19:27:02 »

Quote
im still in my planning phase, so some thought may be unfinished.
if all bricks were standard rectangles i needed only to test if the point on which the direction*speed vector is pointing lies within the bounding box.

now for the polygons. tom, you got a main problem:
even if i store all normales for each plane i additionally need to know the exact intersection point.
i only know one way to test this, to calculate the intersection of both lines (the one is the plane itself, the other is the line following the ball's direction vector).
but line intersection is pretty expensive so i want to consider all possible methods before using them ...


what about what I wrote ?
Offline Serethos

Junior Devvie




Java games rock!


« Reply #5 - Posted 2005-01-11 05:49:29 »

ohhh, im very sorry, i overstepped your suggestion  Shocked

but i didnt really get the clue. you have to explain it carefully.

- check for collision:
yes, thats the main problem. do you mean a precollision over bounding boxes ?

- normalize the speed vector
up to now i realize movement over an always normalized direction vector and a speed scalar

- backtrace trajectory
sure, but the question is, with which method ?
for tracing the collision point (and later calculating the gradient of the small surface) i only see the method of line intersection
Offline KONI

Junior Devvie




Java games rock!


« Reply #6 - Posted 2005-01-11 16:11:56 »

In my destructible terrain demo, I use a collision map and check with the position of the object if it is a collision or not.

I hope this topic is about how to react physically to an object collidion with a vertical plane instead of being a "how to know if an object has collided" topic.

Because what I wrote was mainly how to react and not how to detect a collision.
Offline Serethos

Junior Devvie




Java games rock!


« Reply #7 - Posted 2005-01-12 06:00:42 »

thats the pronlem. perhaps i did not mention it clearly, but i have never taken a collision map into view for arkanoid style game.
so i really have to widen the topic to, which is the probably best way to test ball to diagonal spheres collision.
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.

toopeicgaming1999 (71 views)
2014-11-26 15:22:04

toopeicgaming1999 (60 views)
2014-11-26 15:20:36

toopeicgaming1999 (14 views)
2014-11-26 15:20:08

SHC (27 views)
2014-11-25 12:00:59

SHC (25 views)
2014-11-25 11:53:45

Norakomi (31 views)
2014-11-25 11:26:43

Gibbo3771 (25 views)
2014-11-24 19:59:16

trollwarrior1 (38 views)
2014-11-22 12:13:56

xFryIx (77 views)
2014-11-13 12:34:49

digdugdiggy (55 views)
2014-11-12 21:11:50
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!