Exemple #1
0
        public bool RayCastAll(Vector3 from, Vector3 to, int filterMask, int filterGroup, List <Vector3> contactPoints, List <Vector3> contactNormals)
        {
            bool hasHit = false;

            BulletSharp.CollisionWorld.AllHitsRayResultCallback callback = new BulletSharp.CollisionWorld.AllHitsRayResultCallback(from, to);
            callback.CollisionFilterGroup = (BulletSharp.CollisionFilterGroups)filterGroup;
            callback.CollisionFilterMask  = (BulletSharp.CollisionFilterGroups)filterMask;
            hasHit = callback.HasHit;
            if (hasHit)
            {
                int numHits = callback.HitNormalWorld.Count;
                for (int i = 0; i < numHits; ++i)
                {
                    contactPoints.Add(callback.HitPointWorld[i]);
                    contactNormals.Add(callback.HitNormalWorld[i]);
                }
            }



            return(hasHit);
        }
        public bool RayCastAll(Vector3 from, Vector3 to, int filterMask, int filterGroup, List<Vector3> contactPoints, List<Vector3> contactNormals)
        {

            bool hasHit = false;
            BulletSharp.CollisionWorld.AllHitsRayResultCallback callback = new BulletSharp.CollisionWorld.AllHitsRayResultCallback(from, to);
            callback.CollisionFilterGroup = (BulletSharp.CollisionFilterGroups)filterGroup;
            callback.CollisionFilterMask = (BulletSharp.CollisionFilterGroups)filterMask;
            hasHit = callback.HasHit;
            if (hasHit)
            {
                int numHits = callback.HitNormalWorld.Count;
                for (int i = 0; i < numHits; ++i)
                {
                    contactPoints.Add(callback.HitPointWorld[i]);
                    contactNormals.Add(callback.HitNormalWorld[i]);
                }
            }



            return hasHit;
        }