![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| Software Programming Software programming talk, ask questions about computer software programming or help others |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| Hi, I am working on a breakout clone and I am a bit stuck on how to efficiently code up collision detection. I have a simple algorithm that detects collisions between rectangles so I can tell if the ball has hit a brick. The problem is I am not sure how to do the calculations to determine where on the brick the ball hit, so I can then do the appropriate collision response. For example if the ball hits the horizontal edge of a brick then its y-axis velocity should be changed, and if the ball hits the vertical edge of a brick then its x-axis velocity should be changed. The only thing I can think of is to create a line that represents the trajectory of the ball and then check against each surface of the brick to see if it intersects. I can reduce the number of surfaces to check on the brick by looking at the direction the ball of travelling eg. if the ball is travelling toward the top-left of the screen then I only need to check the bottom horizontal surface and the right vertical surface of the brick. Is there a simpler/smarter way to do this? Anyone know of a good reference site that talks about this? At a later stage I would like to add rotation to the ball, but for now I just want to get something simple running. Thanks Ty | |||
| | #2 | ||
| Ty - You probably already have a solution, but I found this article. http://www.mvps.org/directx/articles...ng_spheres.htm on collision detection for spheres To Newsgroup Games.programming I am a curler ( a Canadian game ) which has similar collisions to pool table ball to ball collisions. Whenever I watch or participate in curling, I think that judgment skills could be enhanced by a better understanding of the collision physics involved. (both planned offset and sweeping judgment skills - plan b shots, etc) Being an engineer, I start thinking about programming a collision simulator but am rusty on my circular collision equations. I was hoping that someone from this newsgroup could point me in the right direction to get started on .circular collision equations. I need a) equations for - simple circular collisions - more complex rotation collisions to account for direction changes due to spin - very advanced - to take ice interaction into account. Objective: Set up on overhead view of house - the area where the collisions occur Populate with rocks ( maybe in future marry a TV frame grabber and verify simulation with actual shots) Show the possible outcomes of initial rock collision for a) plus/minus angle windows for next collision b) translate that into the horizontal offset view c) duplicate for multiple collisions Regards Peter =========== "T" <csaweb@ozemail.com.au> wrote in message news:va2Jb.73413$aT.66309@news-server.bigpond.net.au... > Hi, > > I am working on a breakout clone and I am a bit stuck on how to efficiently > code up collision detection. > > I have a simple algorithm that detects collisions between rectangles so I > can tell if the ball has hit a brick. The problem is I am not sure how to > do the calculations to determine where on the brick the ball hit, so I can > then do the appropriate collision response. For example if the ball hits > the horizontal edge of a brick then its y-axis velocity should be changed, > and if the ball hits the vertical edge of a brick then its x-axis velocity > should be changed. > > The only thing I can think of is to create a line that represents the > trajectory of the ball and then check against each surface of the brick to > see if it intersects. I can reduce the number of surfaces to check on the > brick by looking at the direction the ball of travelling eg. if the ball is > travelling toward the top-left of the screen then I only need to check the > bottom horizontal surface and the right vertical surface of the brick. Is > there a simpler/smarter way to do this? > > Anyone know of a good reference site that talks about this? > > At a later stage I would like to add rotation to the ball, but for now I > just want to get something simple running. > > > Thanks > Ty > > | |||
| Featured Websites | ||||
|
![]() |
| Tags: accurate, collision, detection |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How accurate is my speed? | David Steward | GPS | 43 | 06-25-2007 11:54 PM |
| Accurate colors | vladimirestragon | Graphics in general | 1 | 06-11-2007 7:19 PM |
| HELP! I'm locked out of XP because of a chasis intrusion detection | Gazwad | Windows | 2 | 06-11-2007 5:23 PM |
| recommend an intrusion detection system | Dica | Website Reviews And Website Questions | 1 | 05-28-2007 12:07 AM |
| Featured Websites | ||||
|