Exemplo n.º 1
0
 public override float AddSingleResult(LocalRayResult rayResult, bool normalInWorldSpace)
 {
     if (rayResult.LocalShapeInfo != null)
     {
         Success = true;
         TriangleIndex = rayResult.LocalShapeInfo.TriangleIndex;
     }
     return base.AddSingleResult(rayResult, normalInWorldSpace);
 }
 public override float AddSingleResult(LocalRayResult rayResult, bool normalInWorldSpace)
 {
     CollisionObject = rayResult.CollisionObject;
     CollisionObjects.Add(rayResult.CollisionObject);
     if (normalInWorldSpace)
     {
         HitNormalWorld.Add(rayResult.HitNormalLocal);
     }
     else
     {
         // need to transform normal into worldspace
         HitNormalWorld.Add(Vector3.TransformCoordinate(rayResult.HitNormalLocal, CollisionObject.WorldTransform.Basis));
     }
     HitPointWorld.Add(Vector3.Lerp(RayFromWorld, RayToWorld, rayResult.HitFraction));
     HitFractions.Add(rayResult.HitFraction);
     return ClosestHitFraction;
 }
Exemplo n.º 3
0
 public override float AddSingleResult(LocalRayResult rayResult, bool normalInWorldSpace)
 {
     return base.AddSingleResult(rayResult, normalInWorldSpace);
 }
        public override float AddSingleResult(LocalRayResult rayResult, bool normalInWorldSpace)
        {
            if (rayResult.CollisionObject == _me)
                return 1.0f;

            return base.AddSingleResult(rayResult, normalInWorldSpace);
        }
        public override float AddSingleResult(LocalRayResult rayResult, bool normalInWorldSpace)
        {
            //caller already does the filter on the m_closestHitFraction
            Debug.Assert(rayResult.HitFraction <= ClosestHitFraction);

            ClosestHitFraction = rayResult.HitFraction;
            CollisionObject = rayResult.CollisionObject;
            if (normalInWorldSpace)
            {
                HitNormalWorld = rayResult.HitNormalLocal;
            }
            else
            {
                // need to transform normal into worldspace
                HitNormalWorld = Vector3.TransformCoordinate(rayResult.HitNormalLocal, CollisionObject.WorldTransform.Basis);
            }
            HitPointWorld = Vector3.Lerp(RayFromWorld, RayToWorld, rayResult.HitFraction);
            return rayResult.HitFraction;
        }
 public abstract float AddSingleResult(LocalRayResult rayResult, bool normalInWorldSpace);
Exemplo n.º 7
0
 public override double AddSingleResult(LocalRayResult rayResult, bool normalInWorldSpace)
Exemplo n.º 8
0
        public override float AddSingleResult(LocalRayResult rayResult, bool normalInWorldSpace)
        {
            var c1 = rayResult.CollisionObject.UserObject as EngineContainer;

            if ((c1 == null && c1 == Container) || (SkipGhost && c1.CollisionType == COLLISION_TYPE.Ghost))
            {
                return 1.0f;
            }

            var r0 = Container?.Room;
            var r1 = c1?.Room;

            if (r0 == null || r1 == null)
            {
                return base.AddSingleResult(rayResult, normalInWorldSpace);
            }

            if (r0 != null && r1 != null)
            {
                if (r0.IsInNearRoomsList(r1))
                {
                    return base.AddSingleResult(rayResult, normalInWorldSpace);
                }
            }

            return 1.0f;
        }