OpenSim.Region.Physics.BulletDotNETPlugin.BulletDotNETScene.SetTerrain C# (CSharp) Method

SetTerrain() public method

public SetTerrain ( bool heightMap ) : void
heightMap bool
return void
        public override void SetTerrain(bool[] heightMap)
        {

            if (m_terrainShape != null)
                DeleteTerrain();

            m_terrainShape = AddPrim(
                "__TERRAIN__",
                new Vector3(Constants.RegionSize / 2, Constants.RegionSize / 2, Constants.RegionSize / 2),
                new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize),
                Quaternion.Identity,
                voxmesher.ToMesh(heightMap),
                PrimitiveBaseShape.Default,
                false);
            //float AabbCenterX = Constants.RegionSize/2f;
            //float AabbCenterY = Constants.RegionSize/2f;

            //float AabbCenterZ = 0f;
            /*
            float temphfmin, temphfmax;

            temphfmin = hfmin;
            temphfmax = hfmax;

            if (temphfmin < 0)
            {
                temphfmax = 0 - temphfmin;
                temphfmin = 0 - temphfmin;
            }
            else if (temphfmin > 0)
            {
                temphfmax = temphfmax + (0 - temphfmin);
                //temphfmin = temphfmin + (0 - temphfmin);
            }
            AabbCenterZ = temphfmax/2f;
            
            if (m_terrainPosition == null)
            {
                m_terrainPosition = new btVector3(AabbCenterX, AabbCenterY, AabbCenterZ);
            }
            else
            {
                try
                {
                    m_terrainPosition.setValue(AabbCenterX, AabbCenterY, AabbCenterZ);
                } 
                catch (ObjectDisposedException)
                {
                    m_terrainPosition = new btVector3(AabbCenterX, AabbCenterY, AabbCenterZ);
                }
            }
            */
            if (m_terrainMotionState != null)
            {
                m_terrainMotionState.Dispose();
                m_terrainMotionState = null;
            }
            m_terrainTransform = new btTransform(QuatIdentity, m_terrainPosition);
            m_terrainMotionState = new btDefaultMotionState(m_terrainTransform);
        }