Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Inactive » geometry.forum

Topic: Dead list?
Replies: 3   Last Post: Jan 6, 2000 10:59 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Zorba the Hutt

Posts: 2
Registered: 12/8/04
Dead list?
Posted: Dec 23, 1999 10:41 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


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





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.