0 votes

I am actually working on a simple project and I want some cube to disappear slowly when the arrived in a CollisionShape. So I decided to use a Tween to interpolate the alpha property of the albedo of the material of the meshInstance. But this change work for every cube of the world and I don't understand why. Here is my code :

func disappear(): var mat = $MeshInstance.get_mesh().get_material().duplicate() var tween = Tween.new() add_child(tween) tween.interpolate_property(mat, "albedo_color:a", 1, 0, 1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT) tween.start() $MeshInstance.get_mesh().set_material(mat)

The function disappear() is call when the object collide with the collisionShape.
My cube object is very simple. This is a StaticBody composed of a MeshInstance and a CollisionShape
Thanks for any help !

in Engine by (12 points)

Please log in or register to answer this question.

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 Frequently asked questions and 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 [email protected] with your username.