• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

Monk73

Advanced (?) collision detection

6 posts in this topic

Im working on my first game ever and I have made a prototype for a 2D Pinball-simulation and after lotsa effort most off the collision detection is working just as I wanted it to do, but theres one equation Im not able to solve (or even find for that matter) and its when Im trying to calculate when and where the ball will hit the flipper (or the other way around). I describe the ball as the four tuple (Pos, Velocity, Acceleration, radius) and the Flipper (Pivot, Angel, Angulary speed), well theres a few more parameters but they isnt nessesary for this problem. Whats making it hard (for me ) is the fact that the flipper is moving with an angulary speed and the ball is moving in a stright line (every timestep that is). At the moment Ill move the flipper and then check if hit did hit the ball, if it did I just move the ball and gives it it''s new speed. This works but sometimes the result gets a bit peculiar cos'' I pretend the ball stands still when I update the flipper and vice versa. Sooo, Im hoping that someone could help me find the equation to solve the Collision time t and Collision Pos(x,y). /Thanks
0

Share this post


Link to post
Share on other sites
Your approach seems good but it sounds af if you''re suffering from the main problem with using fixed time steps: they work fine for things moving uniformly over the time step but if there''s a sudden acceleration part way through the calculations done at the beginning/end can become very inaccurate.

One solution is divide your timestep to avoid this. In this case divide it into before and after the collision. You will need to know the precise time of the collision, which you can get from e.g. interpolating the penetration distance of the ball and flpper (it should be negative then positive, indicating a collision at penetration = 0 at an itermediate time).

Knowing this time you can work out the motion up to this time, resolve the collision then work out the motion with the new velocity/velocities from this time to the end of the time step. As long as the collision is instantaneous, i.e. the ball and flipper are solid and so the collision takes no time to complete, this can work well.
0

Share this post


Link to post
Share on other sites
Thx for the reply, maybe I should have been clearer.
I do exactly what u suggest: when I find a collision I''ll devide the timestep and continue to look for more possible collisions within that timestep, and it works great with all obstacles that doesnt move (walls eg. lines, arcs and cirkles, bumbers etc) and it should work just fine with obstacles that moves using the same equations as the ball (eg. a multiball situation).

My problem now is to find the right equation for the ball/flipper collision... and my limited knowledge in math . I need to solve the time and pos for the collision wich would be a peice of cake if the flipper had a similar movement as the ball but my head just hurts because of the angular speed of the flipper... I have read all my old mathbooks without any result..
Thx
0

Share this post


Link to post
Share on other sites
My problem now is to find the right equation for the ball/flipper collision... and my limited knowledge in math . I need to solve the time and pos for the collision wich would be a peice of cake if the flipper had a similar movement as the ball but my head just hurts because of the angular speed of the flipper... I have read all my old mathbooks without any result..

That''s why interpolation''s nice. Work out the positions at the start and end of the period in question, and work out the penetration at both times. For collision one should be positive and one should be negative. The time is then got from these. E.g. if the distance goes from 1 to -2 the collision is at time = 1/3 of the time interval.

If this is not accurate enough you can use quadratic interpolation. Work out the positions at the start end and middle of the period, then work out the penetrations at each time. Plotting these on a graph you can draw a curve joining them and the point of intersection is where the line crosses the dist = 0 axis.
0

Share this post


Link to post
Share on other sites
I don''t understand the real point of your problem: Is it that you can''t calculate the exact point of time / impact position of the ball and flipper (collision detection) or is it the formula to apply to the ball in order to change it''s state (acceleration, velocity) as a response to a collision ?
0

Share this post


Link to post
Share on other sites
The problem is that I cannot find the proper equations/method to find the time and position when a collision occurs between the ball and a moving flipper. I have figured out all other collisions (line, arc, circle and another ball).

0

Share this post


Link to post
Share on other sites
Add to the current ball vector the vector perpendicular to the flipper at the time at which the ball hit the flipper. Use a ray-line intersection test for that.
0

Share this post


Link to post
Share on other sites