Add Per Instance Random node to Anim Graph

This commit is contained in:
2026-04-14 16:02:31 +02:00
parent 9bb7733b33
commit a14599bb15
2 changed files with 19 additions and 0 deletions
@@ -1126,6 +1126,18 @@ namespace FlaxEditor.Surface.Archetypes
NodeElementArchetype.Factory.Text(0, Surface.Constants.LayoutOffsetY * 8, "Nodes:", tooltip:"Amount of nodes in a chain to simulate, starting from the End Node going up in the hierarchy. Excluding root node the chain is attached to."),
}
},
new NodeArchetype
{
TypeID = 36,
Title = "Per Instance Random",
Description = "Per object instance random value (normalized to range 0-1)",
Flags = NodeFlags.AnimGraph,
Size = new Float2(200, 30),
Elements = new[]
{
NodeElementArchetype.Factory.Output(0, "", typeof(float), 0),
}
},
};
}
}
@@ -2653,6 +2653,13 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
value = nodes;
break;
}
// Per Instance Random
case 36:
{
auto* actor = ScriptingObject::Cast<Actor>(context.Data->Object);
value = actor ? actor->GetPerInstanceRandom() : 0.0f;
break;
}
default:
break;
}