Exemple #1
0
            private void HandleMesh(MeshCollider *collider, ref Translation translation, ref Rotation rotation)
            {
                RigidTransform colliderTransform = new RigidTransform(rotation.Value, translation.Value);
                Aabb           aabb        = collider->CalculateAabb(colliderTransform);
                DtBoundingBox  colliderBox = new DtBoundingBox(aabb.Min, aabb.Max);

                if (DtBoundingBox.Intersects(ref TileBounds.Bounds, ref colliderBox))
                {
                    MeshGeometryCollector collector = new MeshGeometryCollector(InputBuilder, collider, colliderTransform, TileBounds.Bounds);
                    collector.Collect();
                }
            }
Exemple #2
0
            private bool SetActiveBoundsFilters(DtBoundingBox colliderBounds)
            {
                bool hasFilter = false;

                for (int i = 0; i < BoxFilters.Length; i++)
                {
                    BoxFilter filter = BoxFilters[i];
                    if (DtBoundingBox.Intersects(ref filter.Bounds, ref colliderBounds))
                    {
                        filter.Active = true;
                        hasFilter     = true;
                    }
                    else
                    {
                        filter.Active = false;
                    }
                    BoxFilters[i] = filter;
                }
                return(hasFilter);
            }
Exemple #3
0
            private void HandleTerrain(TerrainCollider *collider, ref Translation translation, ref Rotation rotation)
            {
                RigidTransform colliderTransform = new RigidTransform(rotation.Value, translation.Value);
                Aabb           aabb        = collider->CalculateAabb(colliderTransform);
                DtBoundingBox  colliderBox = new DtBoundingBox(aabb.Min, aabb.Max);

                if (DtBoundingBox.Intersects(ref TileBounds.Bounds, ref colliderBox))
                {
                    TerrainGeometryCollector collector = new TerrainGeometryCollector
                    {
                        InputBuilder    = InputBuilder,
                        TerrainCollider = collider,
                        Transform       = colliderTransform,
                        Bounds          = TileBounds.Bounds,
                        GeometryFilter  = GeometryFilter
                    };

                    if (SetActiveBoundsFilters(colliderBox))
                    {
                        collector.SetBoundsFilters(BoxFilters);
                    }
                    collector.Collect();
                }
            }