how to change the colors of CPU particles in godot

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By cozmic

I tried changing using the color tab in CPU particle’s properties but this did not work, would really appreciate the help.

:bust_in_silhouette: Reply From: Yuminous

The color property does not affect 3D meshes — if you have a 3D mesh then the color has to be changed through the 3D mesh material.

(Mesh > Material > Albedo > Color)

What if you wanted to change the colour over time? How would you do that?

Pro_Rookie_Gamer | 2022-02-09 22:05

Sure. So in reference to 3D particle meshes, you can access the albedo (colour) property with $CPUParticles.mesh.get_material().albedo_color (ensure you first give your mesh a spatial material).

To animate this, the easiest way might be to use a Tween node and a script like follows:

onready var tween = $Tween
onready var CPUmaterial = $CPUParticles.mesh.get_material()

func ur_function(here):
tween.interpolate_property(CPUmaterial, "albedo_color", Color(0,0,0),
Color(1,1,1), 1, Tween.TRANS_EXPO, Tween.EASE_IN_OUT)

Which looks like this:

Working Example

Hope it helps!

Yuminous | 2022-02-10 00:11