Jump to content
  • Advertisement
Sign in to follow this  
murkis

collision

This topic is 4852 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
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
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!