def reset(self, center_point):
        """
        Update terrain according to current map
        """
        if not self.use_mesh_terrain and self.plane_collision_terrain is None:
            # only generate once if plane terrain
            self.generate_plane_collision_terrain()

        if self.render or self.use_mesh_terrain:
            # modify default height image
            drivable_region = self.get_drivable_region(center_point)
            assert (drivable_region is
                    None) or (isinstance(drivable_region, np.ndarray) and drivable_region.dtype == bool)

            # embed to the original height image
            start = self._heightfield_start
            end = self._heightfield_start + self._heightmap_size
            heightfield_base = np.copy(self.heightfield_img)

            if drivable_region is None:
                drivable_area_height_mean = self.heightfield_img[start:end, start:end, ...].mean()
                heightfield_base = np.where(
                    heightfield_base > (drivable_area_height_mean - self._terrain_offset),
                    heightfield_base - (drivable_area_height_mean - self._terrain_offset), 0
                ).astype(np.uint16)
                heightfield_to_modify = heightfield_base[start:end, start:end, ...]
                heightfield_base[start:end, start:end, ...] = self._terrain_offset
                logger.warning(
                    "No map is found in map region, "
                    "size: [{}, {}], "
                    "center: {}".format(self._semantic_map_size, self._semantic_map_size, center_point)
                )
            else:
                drivable_area_height_mean = np.mean(
                    self.heightfield_img[start:end, start:end, ...][np.where(drivable_region)]
                )
                heightfield_base = np.where(
                    heightfield_base > (drivable_area_height_mean - self._terrain_offset),
                    heightfield_base - (drivable_area_height_mean - self._terrain_offset), 0
                ).astype(np.uint16)
                heightfield_to_modify = heightfield_base[start:end, start:end, ...]
                heightfield_base[start:end, start:end,
                                 ...] = np.where(drivable_region, self._terrain_offset, heightfield_to_modify)

            # generate collision mesh
            if self.use_mesh_terrain:
                self._generate_collision_mesh(
                    heightfield_base if self.full_size_mesh else heightfield_to_modify, self._height_scale
                )

            if self.render:
                # Make semantics for shader terrain
                self.semantic_tex.clearRamImage()
                rrr = self.get_terrain_semantics(center_point)
                self.semantic_tex.setRamImage(rrr)
                # Make height field
                self.heightfield_tex.clearRamImage()
                self.heightfield_tex.setRamImage(heightfield_base)
                # generate terrain visualization
                self._generate_mesh_vis_terrain(self._terrain_size, self.heightfield_tex, self.semantic_tex)
        # reset position
        self.set_position(center_point)
        self.attach_to_world(self.engine.render, self.engine.physics_world)

        Update terrain according to current map
        
metadrive/engine/core/terrain.py