• Create Account

## Fast collision detection

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

### #1Qoy  Members

127
Like
Likes
Like

Posted 04 January 2000 - 06:21 PM

In my last game, I did movement and animation so that the characters moved x pixels per frame, etc, and capped the framerate. In the current one I''m planning to do movement so that it moves x pixels per second, so I will be multiplying speed by velocity to get distance. But I was thinking that for collision detection, this could present a problem, because the sprites might move through each other, and not ever touch if it is running on a slow system, but a collision should have still occured. How would I do collision detection that searches for a collision along a path instead of only at the exact location of the sprite? I have heard a little about vectors, but I am not quite sure how to do this... Thanks ----------------------------- "Truants move on, cannot stay long, some die just to live" From Immortality, by Pearl Jam http://www.crosswinds.net/~uselessknowledge

### #2mason  Members

128
Like
Likes
Like

Posted 08 January 2000 - 01:00 PM

You can use math - there are equations that can tell you whether a line intersects something - or you can take the "lazy" (and slow) way, and just multiple points in between where the sprite was last time and where it is now...

For example, if your sprite moved 150 pixels, but you need collision detection accurate to 10 pixels, you divide the deltax and deltay by 10 and then step through the collision code 15 times (150 pixels / maximum of 10 pixels without a collision check = 15).

Mason McCuskey
Spin Studios - home of Quaternion, 2000 GDC Indie Games Fest Finalist!
www.spin-studios.com

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.