# Collision detection on "star control"

This topic is 4935 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

i want to program a game similiar to "star control" (two ships shooting at each other in a 2d space). what method should i use to check if the ships are hit by each other or the projectiles they fire. i mean, what method do you suppose they used at that game...

##### Share on other sites
Start Control 2 Source

heres a link to Star Control 2 source - or remake of it on sourceforge. thought you might be interested in it.

As far as what method to use .. I would start by using simple distance calculation from one ship to another or projectile to another and use bounding circles to quickly determine if the projectile hits/misses.

Because their is only two ships I dont think you would need to use anything elaborate (like a quadtree), brute force will work just fine. If the projectile / object is within the targets radius you can do further calculations if you want to test for more acurate hit detection.

##### Share on other sites
Thanks for the link... what about the possibility that the projectile will have a very large speed, and it will never be inside the ship's area, although, it crosses it?

##### Share on other sites
Depending on how complex you would want to make it you could do it two ways:

1st) If the projectile is that fast then you would not see the projectile, because it is too fast. maybe just see tracers in place for graphics -- In this case you would just calculate if the ray of the projectile intersects with the bounding circle at the time the shot is fired.

2nd) you would calculate if the path of the two objects intersected during the time between one frame and another. Heres a link to something on nehe that might help, I know gamasutra has a good article on the subject, with some simple math (i'll search for it):

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=30

##### Share on other sites
thanks alot :)
one last question-
what model is used for the actual checking-
is checking if the projectile is in the bounding rectangle realistic enough, or do they use another geometric model?

##### Share on other sites

http://www.gamasutra.com/features/19991018/Gomez_2.htm

This should help/solve your collision problem (if it arises).

Checking to see if the projectile hit the bounding rectangle should be good enough in most cases but, this also depends on your physics model to, if its simple or complex. I would do per-pixel collision after finding out if you hit inside the rectangle/sphere.

1. 1
2. 2
3. 3
Rutin
19
4. 4
khawk
14
5. 5
frob
12

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633659
• Total Posts
3013208
×