Exemple #1
0
        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;
        }
Exemple #2
0
 private void addTree(Tree newTree)
 {
     this.trees.Add(newTree);
 }