Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Dead list?

1 view
Skip to first unread message

Zorba the Hutt

unread,
Dec 23, 1999, 3:00:00 AM12/23/99
to

Here's a really nasty problem I've been trying to figure out. I'm writing a
top-down spaceship game, and I'm getting stumped with the collision
detection. The problem is that the "game cycle" is 60 frames per second.
Unfortunately, in 1/60th of a second, ships can move FAST. What I want to be
able to do is, given the start position, a vector (the direction and speed
the ship is going), and a radius for two ships, determine if and where they
intersect. The method I'm currently using is "find the distance between the
two locations, if it's less than firstradius+secondradius then they just hit
each other". This won't work for very high speeds - the ships could pass
straight through each other and out the other side in the time of one tick.

Just to give an idea of the things that may happen . . .

Two ships, traveling at huge speeds, missing each other by a very small
distance
One ship traveling at huge speeds hitting a ship at a virtual standstill
Two ships racing towards each other at huge speeds
Here's a nasty one: two ships in formation, one directly behind the other,
traveling at high speed
And a similar case where the rear ship is traveling fast enough to hit and
pass through the front ship . . .

Now, if this isn't hard enough . . .

Make an option for the circles to be empty. (These circles represent the
ships' shields, btw). One ship could conceivably drop its shields, the
second ship flys in, and the first ship raises its shield again. We assume
the second ship is much smaller, so it *can* fit in the space between the
larger ship and its shields. They will not intersect (unless one makes a
course correction and the other one doesn't, of course.)

Now, if this isn't hard enough . . .

The circles should be somewhat deformable. Nothing major - I'd be inputting
a "height", a "width", and an "angle", and then doing whatever calculations
would be necessary to make this into more useful data for the game. A long
sleek ship is NOT going to have a shield shaped like a perfect circle.
Everything mentioned above will still apply.

Now, if this isn't hard enough . . .

Add arbitrary polygons, quite possibly concave (something has to happen when
the shields get blown away, right? at the moment the ship explodes when the
shield goes down.) Once again, everything above applies, except these shapes
would be solid (though a toggle would be nice).

Now, if this isn't hard enough . . .

I also will need the ability for laser weapon intersection. I'd need to get
back a list of what it hits in what order. Actually, I need this for all the
ships (so they only hit the first target and then bounce). Naturally, this
would just be a line. This one actually shouldn't be too hard, especially
considering that only the laser entity needs to get an "intersection"
message.

And that's the problem. Hopefully, it won't get much harder :)

Hope someone can help,

Thanks,

-Zorba


Wilson

unread,
Dec 24, 1999, 3:00:00 AM12/24/99
to
So, are you wanting an answer to a programming problem or a geometry
problem? This sounds more like a programming problem than anything else.
If you just want to be able to determine if two vectors will intersect
within a givin range (screen), then you just need a simple system of
equations (linear algebra). This is the method that most game programmers
use, I have friends that do this stuff all day for the game companies.
Good luck, Colin

Zorba the Hutt

unread,
Dec 24, 1999, 3:00:00 AM12/24/99
to

Nuh-uh. I don't care if they're on the screen, and I need more than just two
vectors. The vectors have circles attached to them, remember . . . they
could be parallel and still collide. (right next to each other traveling in
opposite directions). I'm not sure exactly what branch of math this would
be, but it seems geometry would be at least a start, seeing as how it's 2d
shapes I'm looking at/for.

I'm working out some stuff on my own, slowly - you can think of it as a pair
of vertical cylinders skewed (considering Z to be time). The equation would
be:

( x - ( Sx + Vx * z ) )^2 + ( y - ( Sy + Vy * z ) )^2 - r^2 = 0
for 0 <= z <= 1.

I think. Sx/Sy are the start positions (x and y), Vx/Vy are the velocities,
r is radius. (Please let me know if there's a more standard way of writing
this equation.)

So what I'm looking for is a standard way of getting the lowest z value
where two of these equations (with different numbers) are true. And I have
no idea where to even start with this one.

Incidentally, I've already tried programming places. They say it's a math
problem. The math people say it's a geometry problem. So here I am . . .

-Zorba

Andrew Ritz

unread,
Jan 6, 2000, 3:00:00 AM1/6/00
to geometr...@moderators.isc.org
If you are using 2 circles, then the best collision detection method would to be
to compare the distance between the centers of the circles. Check out
perplexed.com for help on this kind of stuff.

-Andrew A. Ritz

www.geocities.com/SoHo/Cafe/4441/

0 new messages