Add Instance Transform node to Anim Graph

This commit is contained in:
2026-04-16 15:24:50 +02:00
parent a8165f58bc
commit f87515305b
2 changed files with 37 additions and 0 deletions
@@ -1138,6 +1138,21 @@ namespace FlaxEditor.Surface.Archetypes
NodeElementArchetype.Factory.Output(0, "", typeof(float), 0),
}
},
new NodeArchetype
{
TypeID = 37,
Title = "Instance Transform",
Description = "Animated model transformation (in world space).",
Flags = NodeFlags.AnimGraph,
Size = new Float2(200, 80),
Elements = new[]
{
NodeElementArchetype.Factory.Output(0, "", typeof(Transform), 0),
NodeElementArchetype.Factory.Output(1, "Position", typeof(Vector3), 1),
NodeElementArchetype.Factory.Output(2, "Rotation", typeof(Quaternion), 2),
NodeElementArchetype.Factory.Output(3, "Scale", typeof(Float3), 3),
}
},
};
}
}
@@ -2660,6 +2660,28 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu
value = actor ? actor->GetPerInstanceRandom() : 0.0f;
break;
}
// Instance Transform
case 37:
{
auto* actor = ScriptingObject::Cast<Actor>(context.Data->Object);
const auto& transform = actor ? actor->GetTransform() : Transform::Identity;
switch (box->ID)
{
case 0:
value = Value(transform);
break;
case 1:
value = transform.Translation;
break;
case 2:
value = transform.Orientation;
break;
case 3:
value = transform.Scale;
break;
}
break;
}
default:
break;
}