0 votes

I have a scene that's supposed to mimic a planet. It's current node setup is simply RigidBody > CollisionShape > MeshInstance. The arrows represent parent-child relationship. I have a script on the RigidBody where a color variable is exported so it can be changed via the editor. This is the _ready function of the script:

func _ready():
var material = SpatialMaterial.new()
material.albedo_color = color
get_node("CollisionShape/MeshInstance").get_mesh().set_material(material)
currentVelocity = initialVelocity

This is not working, for some reason. I've tried many combinations of selecting the mesh of the MeshInstance and changing the color of the material or doing what I'm doing now and setting the material of the mesh to a new one with the desired color altogether. I feel like changing the color should be this easy, but perhaps I'm missing something. Any help is greatly appreciated!

asked Apr 19 in Engine by navett52 (21 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 How to use this Q&A? before posting your first questions.