The subcluster is producing (wrong) results

This commit is contained in:
Pascal Serrarens 2026-01-29 11:48:49 +01:00
parent 5aedb30d36
commit d754457a14
2 changed files with 19 additions and 2 deletions

View File

@ -193,8 +193,22 @@ public class Cluster : INucleus {
// This does not work because the prefab nucleus does not have a state
this.prefab.inputs[0].UpdateState(sum);
//this._outputValue = this.output.outputValue;
UpdateResult(this.output.outputValue);
}
public virtual void UpdateResult(Vector3 result) {
// float d = Vector3.Distance(result, this.outputValue);
// if (d < 0.5f) {
// //Debug.Log($"insignificant update: {d}");
// return;
// }
this.outputValue = result;
foreach (INucleus receiver in this.receivers)
receiver.UpdateState();
}
public void UpdateNuclei() {
this.stale++;
if (this.stale > 2)

View File

@ -25,8 +25,11 @@ public class ClusterPrefab : ScriptableObject {
if (this._inputs == null) {
this._inputs = new();
foreach (IReceptor receptor in this.nuclei) {
if (receptor is INucleus nucleus)
this._inputs.Add(nucleus);
if (receptor is INucleus nucleus) {
// inputs have no incoming synapses yet.
if (nucleus.synapses.Count == 0)
this._inputs.Add(nucleus);
}
}
}
return this._inputs;