View Full Version : Collison detection
06-06-2001, 10:09 AM
have I to store an object (like an space-ship) twice in the memory? First for OpenGL and second for the Collisiondetection??
How can I manage it to find the bounding spheres for an object? Example: I load a space-ship from a file and display it.
How can my program compute where the space-ship was hit from the enemy? - Was the ship destroyed or only damaged?
06-06-2001, 08:45 PM
The answer to your first question is no. I am unsure as to your second question, but the thing about whether the ship was destroyed or not, this would depend upon what you decide to do, for example, it could depend on where the ship was hit...
06-06-2001, 11:17 PM
If you want to use bounding spheres, you only need two fields - a centre point and a radius - probably 4 floats (centre.x, centre.y, centre.z & radius).
If an enemy missile comes into the bounding sphere, then you still don't know where or if your object was hit. You then have to check your object for hit points. It will depend on how you store your object. If you use something like octrees or BSPs (really only for static objects) you'll be able to simplify checking. If your object is just a triangle array, you'll most likely have to check each object in your array for a hit.
Have a look at Paul Bourke's excellent site for intersections of various objects - http://astronomy.swin.edu.au/pbourke/geometry/ - you'll typically have to do one of these types of intersections for each subobject that makes up your object and the object that represents your missile.
Hope that helps.
06-06-2001, 11:22 PM
well, I think of loading a spaceship from a file. And then my program has to find out the surfaces who are defined by the vertices.
So my collison-routine has to do the same as OpenGL.
Isn't it possible to read out the z-buffer to find out wether a collision has happened?
Or do you have an other idea to solve this problem?
06-06-2001, 11:24 PM
thanx, i'll check it out.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.