Animating the bones of a skeleton

I’m trying to find out how to port my IK framework into Lumberyard. The first step to take is to control the transformation of a bone of an actor. Is this possible in Lumberyard?

EDIT: got a little bit further and found that you can get the ICharacterInstance* via the following code:

ICharacterInstance* pSkeleton = nullptr;
LmbrCentral::SkinnedMeshComponentRequestBus::BroadcastResult(pSkeleton, &SkinnedMeshComponentRequests::GetCharacterInstance, GetEntityId());

This ICharacterInstance* would allow bone transformations. However now I am stumbling on a new problem, namely how to get the correct include. The ICharacterInstance struct is defined in the ICryAnimation.h file , but this include file is not found in visual studio.

Got a little bit further, needed to add an include path in wscript in the following manner:

includes = [‘Include’,bld.Path(‘Code/CryEngine/CryCommon’)],

And use the macros to get the results I want

 m_CurrentTarget = startLocation;
		
		ICharacterInstance* pSkeleton = nullptr;
		EBUS_EVENT_PTR_RESULT(pSkeleton, GetEntityId(), LmbrCentral::SkinnedMeshComponentRequestBus, GetCharacterInstance);

		if (pSkeleton != nullptr) {
			AZ_Printf("IKWalker", "retrieved skeleton: %s", pSkeleton->GetFilePath());
		}
		else {
			AZ_Printf("IKWalker", "No Skeleton found :(");
		}

		int jointCount = -1;
		EBUS_EVENT_ID_RESULT(jointCount, GetEntityId(), LmbrCentral::SkeletalHierarchyRequestBus,GetJointCount );
		AZ_Printf("IKWalker", "Number of joints %d", jointCount);

The new problem I have that all though the object I am adding this component too is a skinned mesh, but the two busses I tried don’t return a result.

Hi! I long time do not touch LY.
But previously I was made somesort of debug component for debugging volumes of bones. U can take a look on this:
header - https://pastebin.com/aT7VkAgF
source - https://pastebin.com/R0Kdakfu

And I think for all kinda animation instead writing the Std entity’s component you better write your own animation node for EmotionFX . Even for own custom IK.
Here is some my code snippet for this:
register custom EFX node in system component see: void GameProjectSystemComponent::Activate()

EMFX Node code:
MYEFXNODE_H - https://pastebin.com/KCzQ4dQm
MYEFXNODE_CPP https://pastebin.com/rW7bs31m

for the gameproject.waf_files u should add this files too.

		"Source/EmotionFXNode": [
			"Source/EmotionFXNodes/MyEFXNode.h",
			"Source/EmotionFXNodes/MyEFXNode.cpp"
		],

wscript file, there is also a lot about of EMFX… - https://pastebin.com/XPLasAXB

2 Likes