using Godot; using System; using System.Collections.Generic; [Tool] public partial class MetaBallAssigner : Node { [Export] public Node3D metaBallA; [Export] public Node3D metaBallB; [Export] public Node3D metaBallC; [Export] public Node3D metaBallD; [Export] public Node3D metaBallE; [Export] public Node3D metaBallF; [Export] public ShaderMaterial material; public override void _Process( double delta ) { GD.Print( "AS" ); SetMetaBall( metaBallA, "A" ); SetMetaBall( metaBallB, "B" ); SetMetaBall( metaBallC, "C" ); SetMetaBall( metaBallD, "D" ); SetMetaBall( metaBallE, "E" ); SetMetaBall( metaBallF, "F" ); } void SetMetaBall( Node3D node, string metaBallIndex ) { var location = node.GlobalPosition; var scale = node.Scale.Length(); var value = new Vector4( location.X, location.Y, location.Z, scale ); material.SetShaderParameter( "metaBall" + metaBallIndex, value ); } }