예제 #1
0
파일: Tree.cs 프로젝트: faloi/tegece
        public static Tree create(Vector3 initialPosition,Terrain terrain)
        {
            if (baseTree == null)
                createBaseTree();

            count++;

            var newMesh = baseTree.createMeshInstance(baseTree.Name + count);
            newMesh.Position = initialPosition;
            newMesh.Scale = scale;
            newMesh.AlphaBlendEnable = true;

            var newTree = new Tree();
            newTree.mesh = newMesh;

            var newYValue = terrain.getYValueFor(newMesh.BoundingBox.calculateBoxCenter().X,newMesh.BoundingBox.calculateBoxCenter().Z);
            newTree.boundingSphere = new TgcBoundingSphere(new Vector3(newMesh.BoundingBox.calculateBoxCenter().X, newYValue+100f, newMesh.BoundingBox.calculateBoxCenter().Z), 150f);

            return newTree;
        }