Sign in to follow this  
murkis

collision

Recommended Posts

murkis    122
Hello, I need a collision detection between a plane and a ball for my project. I've read all the articles here, but the problem is i'm not so good at math (especially in english) and i couldn't understand the principles of such detection. What i want to do is to find if a ball has hit the plane (THE PLANE IS OBLIQUE [45 degrees]) and reflect the ball from it if there was a collision. Too bad the articles seemed to be too difficult andt that's why i'm asking you to explain the algorithm in simple words from the beggining to the end. I am programming this with DELPHI so if someone knows the syntax i'd be very greatfull for the help. I'm using the following structure to define a ball: type TBall = record val: integer; // just a ball number (doesn't matter here) x, y: real; // coordinates (center) vx, vy: real; // x and y speed values end; I don't even know how to define a plane's structure. So basically i need to: a) define a plane's structure (what parameters i need) b) learn how to get those parameters (normal vectors or plane equations or anything i need here) c) check if a ball has hit the plane d) reflect the ball from the line Thank you very much for your help, if you don't know DELPHI, write it in your words as simply as possible.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Your English seems fine, see here:
http://www.gamasutra.com/features/19991018/Gomez_1.htm

Share this post


Link to post
Share on other sites
murkis    122
it's very difficult for me to understand math in english espacially when i don't have c++ and can't look at vector.h to see how dot products and stuff like that are calculated.

by the way, as i understand, this is only an intersection test, response is still missing...

Share this post


Link to post
Share on other sites
jyk    2094
Your English seems very good - what parts exactly are you having trouble with? Anyway:

"a) define a plane's structure (what parameters i need)"

From the context it seems you're working in 2 dimensions, correct? In this case your 'plane' is actually a line, but it can be defined in the same way, with a normal and a distance from the origin.

"b) learn how to get those parameters (normal vectors or plane equations or anything i need here)"

It depends. You can just 'make them up', or you can convert from some other line representation (explicit, implicit, parametric).

"c) check if a ball has hit the plane"

Presumably this is what the article explains how to do. Generally this is done by plugging the equation for the motion of the circle center, C+tV, into the equation of the line, p•n = d, setting to 'r' (circle radius) and solving for t.

"d) reflect the ball from the line"

The standard equation to reflect a vector 'v' about a unit-length normal 'n' is:

v' = v-2(v•n)n

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this