0 votes

Hello,
I have mesh-object planned as Kinematic Body
and I want to change the emission color in time
....emission colors ( color1 and color2 ) loops in time
i have a script but does not work
Thanks for help,guys

extends MeshInstance

var color_time

export (Color) var color1
export (Color) var color2 

var mesh 
var material = FixedMaterial.PARAM_EMISSION == Color(color1)

const PARAM_EMISSION = 3
#const PARAM_GLOW = 5

func _ready():
    set_process(true)
    mesh = get_node(".")
    mesh.set_material_override(material)
    color_time = get_node("/root/entity_test/entity_02_anim/color_time")


func _process(delta):
    if color_time:
        pass
in Engine by (450 points)

1 Answer

0 votes

I got it..... :-)

extends MeshInstance

var color_time

export (Color) var color1
export (Color) var color2 

var mesh 

const PARAM_EMISSION = 3
#const PARAM_GLOW = 5

func _ready():
    set_process(true)
    mesh = get_node(".")
    color_time = get_node("/root/entity_test/entity_02_anim/color_time")
    self.get_mesh().surface_get_material(0).set_parameter(3, color1)


func _on_color_time_timeout():
    self.get_mesh().surface_get_material(0).set_parameter(3, color2)
by (450 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.