小编Les*_*cka的帖子

Godot3 change color of meshInstance

How can I change mesh color in Godot3 properly?

extends MeshInstance

# class member variables go here, for example:
# var a = 2
# var b = "textvar"
var i=0
export(Color) var new_color = Color(1, 1, 1, 1)
func _ready():
    var n = self
    var mat=n.get_mesh().surface_get_material(0)
    var mat2 = SpatialMaterial.new()
    mat2.albedo_color = Color(0.8, 0.0, 0.0)
    self.get_mesh().surface_set_material(0,mat2)
    set_process(true)
    # Called every time the node is added to the scene.
    # Initialization here
func _process(delta):
    randomize()
    var mat2 = SpatialMaterial.new()
    mat2.albedo_color …
Run Code Online (Sandbox Code Playgroud)

godot

3
推荐指数
1
解决办法
2万
查看次数

标签 统计

godot ×1