[1.6] Swapping ComponentEntity models in real-time?

How would I go around doing this with flowgraph? Or are there other methods?

I plan to have my character have transformation powers and is able to change models freely.

Hey @M4A1CID, you can do that with C++ currently. We do have a roadmap item to allow this to be done through LUA in the future.

Hi @Binky Could the Amazon team make a flowgraph node for swapping models for both Static & Skinned mesh for ComponentEntity components as well in the future?

That would be a pretty good and easy visual feature for game designers who don’t know coding but want to easily change models with flowgraphs.

Also could I have a small example in C++ for swapping Skinned Meshes at the moment?

I’m writing my own custom flowgraph node at the moment and I’m not sure where the pActInfo stores the entity’s model

I will file a request for this. Sounds like a great idea and piece of content to have.

Let me see if I can track something down. Most of the team in on Holiday break right now so it may be a few days…

Hey @M4A1CID, just following up here, we don’t have a C++ code example handy right now but will try to get you something in the next week or so.

Hey @M4A1CID,

If you would like to update the SkinnedMeshComponent’s asset through C++ you can use the EBus as follows (Note: I haven’t tested this out but it should theoretically work):

	CString meshFile = "test.cgf";
// Find the asset Id by path.
AZ::Data::AssetId meshId;
EBUS_EVENT_RESULT(meshId, AZ::Data::AssetCatalogRequestBus, GetAssetIdByPath, meshFile.GetString(), false);
if (meshId.IsValid())
// Assign mesh asset to entityId from FlowGraph
EBUS_EVENT_ID(pActInfo.entityId, LmbrCentral::MeshComponentRequestBus, SetMeshAsset, meshId);

Let us know if that helps!