Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Tort | |
Old Version | Published before Godot 3 was released. |
I’m testing the possibility of deformation of the surface (Change must occur in each frame). Question. Why does productivity decline over time?
extends Node
var terrain = null
var material = null
var mesh_new = Mesh.new()
var MDT = MeshDataTool.new()
func _ready():
terrain = get_node('terrain')
MDT.create_from_surface(terrain.get_child(0).get_mesh(), 0)
material = terrain.get_child(0).get_surface_material(0)
MDT.set_material(material)
func _process(delta):
terrain.get_child(0).set_mesh(mesh_new)
MDT.set_vertex(0, Vector3(MDT.get_vertex(0)[0], -10.0, MDT.get_vertex(0)[2]))
MDT.commit_to_surface(terrain.get_child(0).get_mesh())
Solved
terrain.get_child(0).get_mesh().surface_remove(0)
Tort | 2017-08-25 07:22