PDA

Click to See Complete Forum and Search --> : Collision Detection


PsyVision
Aug 20th, 2000, 10:50 AM
Do any of you have any source of how to do collision detection in Visual Basic using Direct X 7.0 ?

parksie
Aug 20th, 2000, 10:54 AM
Well, there are more complicated methods, but the sphere-boundary one is useful enough. First, create a sphere large enough to hold the whole object, then compare the radii of that and another object's bounding sphere. If they collide, either claim a collision there, or move onto a slower but more accurate method, such as polygon piercing. I don't know too much, but it's a possibility.

HarryW
Aug 20th, 2000, 12:32 PM
To do that, would you identify the vector between the two sphere's centres and then check the length to see if it's less than the sum of the two radii? Or is there an easier method?

This isn't something I know about so I'm just interested.

PsyVision
Aug 20th, 2000, 12:50 PM
anyone else have some code demos on how to do it. I will have a look on PSC for some stuff too.

kedaman
Aug 20th, 2000, 03:10 PM
That's exactly as Harry said...

If sqr((A.X-B.X)^2+(A.Y-B.Y)^2+(A.Z-B.Z)^2)<ARadii+BRadii then ... (check for collisions with vertexes inside the other object)