I use triangles for my terrain. Triangles are created with vertexes and not with a hightmap.
Now I want the player to dig a hole in the ground and have to alter some of my triangles. I can do the rigidbody and collisons but i can’t access the mesh:
this.mesh = pc.createMesh(this.app.graphicsDevice, this.positions, options);
this.node.name = line+row.toString()+'-'+collum.toString();
this.setGroundParameter(); // reset before randomnize
var instance = new pc.MeshInstance(this.node, this.mesh, this.chooseGroundSkin());
this.model = new pc.Model();
this.model.graph = this.node;
this.model.meshInstances = [ instance ];
this.node.tag = 'GroundAttributes';
this.entity.addChild(this.node);
CurrentTerrain = this.entity.children;
CurrentNumber = CurrentTerrain.length -1;
this.model.tag = 'Triangle';
this.model.receiveShadows = true;
this.app.scene.addModel(this.model);
I’ve tryed to add the model somwhere else, but it wont be visible than. Or use findByTag but only got an empty array.
Any hint as always very welcome,
the game is quite confusing, but’s from the ‘farmland’ scene; ‘HomeBase’ entity and the ‘buildTerrain’ script, but i would’t try look this up
Herbivore
thanx Gurki