2 Replies Latest reply on May 20, 2007 2:24 AM by acelep

    Collision Detection

    acelep
      Hi.

      I try to handle collisions on a screen.

      I use modelsUnderRay method to control the collisions.

      To handle +ve X axis I use the below code and that works.
      collisionListX = p3Dmember.modelsUnderRay(boxPos, pCharacter.transform.xAxis,3, #detailed)

      I try to handle Y axis and I write this code, but that one does not work.
      collisionListY = p3Dmember.modelsUnderRay(boxPos, pCharacter.transform.yAxis,3, #detailed)

      Can somebody help me.

      Thanks....




        • 1. Collision Detection
          James Newton, ACP Level 3
          I assume that there is a mesh which you are expecting your ray to detect. What direction are the normals to this mesh facing? If they are facing away from the ray, then the ray will not detect the surface of the mesh.

          A ray will only detect a mesh the first time it encounters the mesh. If you have a mesh in the shape of a Z, for example, and fire a ray at it from below, the ray may pass through the mesh three times, but only the first "impact" will be detected.

          If a ray goes precisely through the vertex of a mesh, it may not be detected: you can see a demonstration of this here. It might help to fire your ray at a slight angle to the yAxis.
          • 2. Re: Collision Detection
            acelep Level 1
            thanks for your reply openSpark.