Universe.Region.SceneObjectGroup.TestIntersection C# (CSharp) Method

TestIntersection() public method

public TestIntersection ( Ray hRay, bool frontFacesOnly, bool faceCenters ) : EntityIntersection
hRay OpenMetaverse.Ray
frontFacesOnly bool
faceCenters bool
return Universe.Framework.SceneInfo.Entities.EntityIntersection
        public EntityIntersection TestIntersection(Ray hRay, bool frontFacesOnly, bool faceCenters)
        {
            // We got a request from the inner_scene to raytrace along the Ray hRay
            // We're going to check all of the prim in this group for intersection with the ray
            // If we get a result, we're going to find the closest result to the origin of the ray
            // and send back the intersection information back to the innerscene.

            EntityIntersection result = new EntityIntersection();

            foreach (SceneObjectPart part in m_partsList)
            {
                // Temporary commented to stop compiler warning
                //Vector3 partPosition =
                //    new Vector3(part.AbsolutePosition.X, part.AbsolutePosition.Y, part.AbsolutePosition.Z);
                Quaternion parentrotation = GroupRotation;
                // Telling the prim to raytrace.
                //EntityIntersection inter = part.TestIntersection(hRay, parentrotation);
                EntityIntersection inter = part.TestIntersectionOBB(hRay, parentrotation, frontFacesOnly, faceCenters);

                // This may need to be updated to the maximum draw distance possible..
                // We might (and probably will) be checking for prim creation from other sims
                // when the camera crosses the border.
                if (m_scene != null)
                {
                    float idist = (m_scene.RegionInfo.RegionSizeX + m_scene.RegionInfo.RegionSizeY) / 2f;
                    if (inter.HitTF)
                    {
                        // We need to find the closest prim to return to the testcaller along the ray
                        if (inter.distance < idist)
                        {
                            result.HitTF = true;
                            result.ipoint = inter.ipoint;
                            result.obj = part;
                            result.normal = inter.normal;
                            result.distance = inter.distance;
                        }
                    }
                }
            }

            return result;
        }
SceneObjectGroup