How to determine the collision of two three-dimensional shapes in space? The language or the way the object is represented is not as important as the algorithm and the corresponding code (of course, better using csharp and the XNA libraries).

Please do not suggest type algorithms: to inscribe both objects in the sphere and to check the collisions of the spheres is the simplest solution, which in my situation does not take into account the specifics of three-dimensional objects.

    5 answers 5

    See the collection of algorithms . Here is an article from there. The idea of ​​this method is to determine whether convex shapes intersect: If there is a straight line, the projections of the figures onto which (segments means) do not intersect, then the figures do not intersect.

    • and if the figure is not convex? - megacoder
    • check the convex hull, then check the desired convex parts - yapycoder
    • and if it is necessary to make a check very often, then on each figure to build a convex hull? too long. maybe there is something more effective? - megacoder
    • Well, it's clear that shells can be built once, moreover, shells are not over a cloud of points, but over vertices - this is more efficient, other efficiencies are offered in other answers, described spheres, rectangles, and so on. My answer basically gives the source of materials and an example of the algorithm. The list of algorithms is large and structured, there are articles and source code. In addition, the question was without special details - yapycoder
    • in any case, your information has been helpful. +1 - megacoder

    On algoliste a lot on this topic. http://algolist.manual.ru/maths/geom/index.php

    In particular, here is the intersection. http://algolist.manual.ru/maths/geom/intersect/

      In any case, the spheres will have to be checked, and only if the spheres have crossed, go deeper and check the intersections of the triangles.

      Look at this article, at the end there is a code for how very simple it is to add processing of coliziums to models. We write games for Windows Phone

        The first thing I want to advise is to never cross physics and graphics. Visual objects are one thing, collision detection is another.

        By sabzh, it is better to use one of the open physics engines. ODE, for example, Bullet, Newtone. They allow not only to detect the fact of intersection of objects (moreover, they do it much faster than handwritten decisions), but also to react to it (in the sense, objects will behave like real ones).

          Well, if you don’t want in the sphere - enter in a rectangular parallelepiped (a cube, for example), and oriented along global coordinate axes ... :) - In principle, this is just the first step, since it is easiest to check for collisions with objects of this kind multiplications - distance calculation, parallelepiped - only comparisons of coordinates) and already if the intersection of parallelepipeds is fixed, then analyze complex polyhedral objects themselves for a collision ... At least this is optimization.

          If you want a good understanding of the theme (3D engines), I advise the book David H. Eberly , 3d Game Engine Design: A Practical Approach to Real-time Computer Graphics . The book covers all aspects of creating 3d engines, including the search for intersections ... PDF can be found on torrent trackers or on the ed2k network.