Need help extending AnimGraph class

Hi,

I’ve developed a plugin to enable users create vehicles with more than 4 wheels. It’s working so far, you can create the vehicle, play with it, but you can’t animate wheels because of a hard coded limitation from AnimNode_WheelHandler class.

I’m trying to extend this class, which is already a devired class from AnimNode_SkeletalControlBase, but, I’m facing problems that is very difficult to resolve for a new programmer… :rolleyes:

Both, SkeletalControlBase and WheelHandler have virtual functions with override, but if I try to override the function body within my class, I end with linker errors, unserolved external symbol. Even if I remove Initialize function, I got the same errors…And I don’t have idea whats going on here…

If I try to extend it from SkeletalControlBase, I will get new problems, already tried to…
It’s like that I have to extend the whole AnimGraph module just to animate those wheel from my custom class ANWheeledVehicle.

To clarify, here are sources:

https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Source/Runtime/AnimGraphRuntime/Public/BoneControllers/AnimNode_WheelHandler.h

https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_WheelHandler.cpp

And these are my try :


// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.

#pragma once

#include "Runtime/AnimGraphRuntime/Public/BoneControllers/AnimNode_WheelHandler.h"
#include "AnimNode_CamberWheelHandler.generated.h"

/**
*	Simple controller that replaces or adds to the translation/rotation of a single bone.
*/
USTRUCT()
struct NWHEELEDVEHICLES_API FAnimNode_CamberWheelHandler : public FAnimNode_WheelHandler
{
	GENERATED_USTRUCT_BODY()

		FAnimNode_CamberWheelHandler();

	virtual void Initialize(const FAnimationInitializeContext& Context) override;


};

And CPP:


#include "NWheeledVehiclesPluginPrivatePCH.h"
#include "../Classes/AnimNode_CamberWheelHandler.h"
#include "../Classes/NWheeledVehicle.h"
#include "Runtime/Engine/Public/Animation/AnimInstanceProxy.h"



FAnimNode_CamberWheelHandler::FAnimNode_CamberWheelHandler()
{
}

void FAnimNode_CamberWheelHandler::Initialize(const FAnimationInitializeContext& Context)
{
	// TODO: only check vehicle anim instance
	// UVehicleAnimInstance
	ANWheeledVehicle * Vehicle = Cast<ANWheeledVehicle>(Context.AnimInstanceProxy->GetSkelMeshComponent()->GetOwner());
	;
	// we only support vehicle for this class
	if (Vehicle != nullptr)
	{
		VehicleSimComponent = Vehicle->GetVehicleMovementComponent();

		int32 NumOfwheels = VehicleSimComponent->WheelSetups.Num();
		if (NumOfwheels > 0)
		{
			WheelSimulators.Empty(NumOfwheels);
			WheelSimulators.AddZeroed(NumOfwheels);
			// now add wheel data
			for (int32 WheelIndex = 0; WheelIndex<WheelSimulators.Num(); ++WheelIndex)
			{
				FWheelSimulator & WheelSim = WheelSimulators[WheelIndex];
				const FWheelSetup& WheelSetup = VehicleSimComponent->WheelSetups[WheelIndex];

				// set data
				WheelSim.WheelIndex = WheelIndex;
				WheelSim.BoneReference.BoneName = WheelSetup.BoneName;
				WheelSim.LocOffset = FVector::ZeroVector;
				WheelSim.RotOffset = FRotator::ZeroRotator;
			}
		}
	}

	FAnimNode_WheelHandler::Initialize(Context);
}

The Output from VS2013 :


30>  Distributing 2 actions to XGE
30>  Performing 2 actions (4 in parallel)
30>  Module.NWheeledVehicles.cpp
30>  [2/2] Link UE4Editor-NWheeledVehicles.dll
30>     Creating library D:\Git\UnrealEngine4.11\Engine\Plugins\Runtime\NWheeledVehicles\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-NWheeledVehicles.lib and object D:\Git\UnrealEngine4.11\Engine\Plugins\Runtime\NWheeledVehicles\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-NWheeledVehicles.exp
30>Module.NWheeledVehicles.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl FAnimNode_WheelHandler::FAnimNode_WheelHandler(void)" (__imp_??0FAnimNode_WheelHandler@@QEAA@XZ) referenced in function "public: __cdecl FAnimNode_CamberWheelHandler::FAnimNode_CamberWheelHandler(void)" (??0FAnimNode_CamberWheelHandler@@QEAA@XZ)
30>Module.NWheeledVehicles.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual void __cdecl FAnimNode_WheelHandler::Initialize(struct FAnimationInitializeContext const &)" (__imp_?Initialize@FAnimNode_WheelHandler@@UEAAXAEBUFAnimationInitializeContext@@@Z) referenced in function "public: virtual void __cdecl FAnimNode_CamberWheelHandler::Initialize(struct FAnimationInitializeContext const &)" (?Initialize@FAnimNode_CamberWheelHandler@@UEAAXAEBUFAnimationInitializeContext@@@Z)
30>Module.NWheeledVehicles.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl FAnimNode_WheelHandler::~FAnimNode_WheelHandler(void)" (__imp_??1FAnimNode_WheelHandler@@UEAA@XZ) referenced in function "public: virtual __cdecl FAnimNode_CamberWheelHandler::~FAnimNode_CamberWheelHandler(void)" (??1FAnimNode_CamberWheelHandler@@UEAA@XZ)
30>NWheeledVehicles.generated.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl FAnimNode_WheelHandler::~FAnimNode_WheelHandler(void)" (__imp_??1FAnimNode_WheelHandler@@UEAA@XZ)
30>Module.NWheeledVehicles.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl FAnimNode_WheelHandler::FAnimNode_WheelHandler(struct FAnimNode_WheelHandler const &)" (__imp_??0FAnimNode_WheelHandler@@QEAA@AEBU0@@Z) referenced in function "public: __cdecl FAnimNode_CamberWheelHandler::FAnimNode_CamberWheelHandler(struct FAnimNode_CamberWheelHandler const &)" (??0FAnimNode_CamberWheelHandler@@QEAA@AEBU0@@Z)
30>NWheeledVehicles.generated.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl FAnimNode_WheelHandler::FAnimNode_WheelHandler(struct FAnimNode_WheelHandler const &)" (__imp_??0FAnimNode_WheelHandler@@QEAA@AEBU0@@Z)
30>Module.NWheeledVehicles.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: struct FAnimNode_WheelHandler & __cdecl FAnimNode_WheelHandler::operator=(struct FAnimNode_WheelHandler const &)" (__imp_??4FAnimNode_WheelHandler@@QEAAAEAU0@AEBU0@@Z) referenced in function "public: struct FAnimNode_CamberWheelHandler & __cdecl FAnimNode_CamberWheelHandler::operator=(struct FAnimNode_CamberWheelHandler const &)" (??4FAnimNode_CamberWheelHandler@@QEAAAEAU0@AEBU0@@Z)
30>NWheeledVehicles.generated.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct FAnimNode_WheelHandler & __cdecl FAnimNode_WheelHandler::operator=(struct FAnimNode_WheelHandler const &)" (__imp_??4FAnimNode_WheelHandler@@QEAAAEAU0@AEBU0@@Z)
30>Module.NWheeledVehicles.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl FAnimNode_SkeletalControlBase::CacheBones(struct FAnimationCacheBonesContext const &)" (?CacheBones@FAnimNode_SkeletalControlBase@@UEAAXAEBUFAnimationCacheBonesContext@@@Z)
30>NWheeledVehicles.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl FAnimNode_SkeletalControlBase::CacheBones(struct FAnimationCacheBonesContext const &)" (?CacheBones@FAnimNode_SkeletalControlBase@@UEAAXAEBUFAnimationCacheBonesContext@@@Z)
30>Module.NWheeledVehicles.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl FAnimNode_WheelHandler::CanUpdateInWorkerThread(void)const " (?CanUpdateInWorkerThread@FAnimNode_WheelHandler@@UEBA_NXZ)
30>NWheeledVehicles.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl FAnimNode_WheelHandler::CanUpdateInWorkerThread(void)const " (?CanUpdateInWorkerThread@FAnimNode_WheelHandler@@UEBA_NXZ)
30>Module.NWheeledVehicles.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl FAnimNode_WheelHandler::EvaluateBoneTransforms(class USkeletalMeshComponent *,struct FCSPose<struct FCompactPose> &,class TArray<struct FBoneTransform,class FDefaultAllocator> &)" (?EvaluateBoneTransforms@FAnimNode_WheelHandler@@UEAAXPEAVUSkeletalMeshComponent@@AEAU?$FCSPose@UFCompactPose@@@@AEAV?$TArray@UFBoneTransform@@VFDefaultAllocator@@@@@Z)
30>NWheeledVehicles.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl FAnimNode_WheelHandler::EvaluateBoneTransforms(class USkeletalMeshComponent *,struct FCSPose<struct FCompactPose> &,class TArray<struct FBoneTransform,class FDefaultAllocator> &)" (?EvaluateBoneTransforms@FAnimNode_WheelHandler@@UEAAXPEAVUSkeletalMeshComponent@@AEAU?$FCSPose@UFCompactPose@@@@AEAV?$TArray@UFBoneTransform@@VFDefaultAllocator@@@@@Z)
30>Module.NWheeledVehicles.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl FAnimNode_SkeletalControlBase::EvaluateComponentSpace(struct FComponentSpacePoseContext &)" (?EvaluateComponentSpace@FAnimNode_SkeletalControlBase@@UEAAXAEAUFComponentSpacePoseContext@@@Z)
30>NWheeledVehicles.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl FAnimNode_SkeletalControlBase::EvaluateComponentSpace(struct FComponentSpacePoseContext &)" (?EvaluateComponentSpace@FAnimNode_SkeletalControlBase@@UEAAXAEAUFComponentSpacePoseContext@@@Z)
30>Module.NWheeledVehicles.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl FAnimNode_WheelHandler::GatherDebugData(struct FNodeDebugData &)" (?GatherDebugData@FAnimNode_WheelHandler@@UEAAXAEAUFNodeDebugData@@@Z)
30>NWheeledVehicles.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl FAnimNode_WheelHandler::GatherDebugData(struct FNodeDebugData &)" (?GatherDebugData@FAnimNode_WheelHandler@@UEAAXAEAUFNodeDebugData@@@Z)
30>Module.NWheeledVehicles.cpp.obj : error LNK2001: unresolved external symbol "private: virtual void __cdecl FAnimNode_WheelHandler::InitializeBoneReferences(struct FBoneContainer const &)" (?InitializeBoneReferences@FAnimNode_WheelHandler@@EEAAXAEBUFBoneContainer@@@Z)
30>NWheeledVehicles.generated.cpp.obj : error LNK2001: unresolved external symbol "private: virtual void __cdecl FAnimNode_WheelHandler::InitializeBoneReferences(struct FBoneContainer const &)" (?InitializeBoneReferences@FAnimNode_WheelHandler@@EEAAXAEBUFBoneContainer@@@Z)
30>Module.NWheeledVehicles.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl FAnimNode_WheelHandler::IsValidToEvaluate(class USkeleton const *,struct FBoneContainer const &)" (?IsValidToEvaluate@FAnimNode_WheelHandler@@UEAA_NPEBVUSkeleton@@AEBUFBoneContainer@@@Z)
30>NWheeledVehicles.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl FAnimNode_WheelHandler::IsValidToEvaluate(class USkeleton const *,struct FBoneContainer const &)" (?IsValidToEvaluate@FAnimNode_WheelHandler@@UEAA_NPEBVUSkeleton@@AEBUFBoneContainer@@@Z)
30>Module.NWheeledVehicles.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl FAnimNode_SkeletalControlBase::Update(struct FAnimationUpdateContext const &)" (?Update@FAnimNode_SkeletalControlBase@@UEAAXAEBUFAnimationUpdateContext@@@Z)
30>NWheeledVehicles.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl FAnimNode_SkeletalControlBase::Update(struct FAnimationUpdateContext const &)" (?Update@FAnimNode_SkeletalControlBase@@UEAAXAEBUFAnimationUpdateContext@@@Z)
30>Module.NWheeledVehicles.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl FAnimNode_WheelHandler::UpdateInternal(struct FAnimationUpdateContext const &)" (?UpdateInternal@FAnimNode_WheelHandler@@UEAAXAEBUFAnimationUpdateContext@@@Z)
30>NWheeledVehicles.generated.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl FAnimNode_WheelHandler::UpdateInternal(struct FAnimationUpdateContext const &)" (?UpdateInternal@FAnimNode_WheelHandler@@UEAAXAEBUFAnimationUpdateContext@@@Z)
30>NWheeledVehicles.generated.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class UScriptStruct * __cdecl Z_Construct_UScriptStruct_FAnimNode_WheelHandler(void)" (__imp_?Z_Construct_UScriptStruct_FAnimNode_WheelHandler@@YAPEAVUScriptStruct@@XZ) referenced in function "class UScriptStruct * __cdecl Z_Construct_UScriptStruct_FAnimNode_CamberWheelHandler(void)" (?Z_Construct_UScriptStruct_FAnimNode_CamberWheelHandler@@YAPEAVUScriptStruct@@XZ)
30>D:\Git\UnrealEngine4.11\Engine\Plugins\Runtime\NWheeledVehicles\Binaries\Win64\UE4Editor-NWheeledVehicles.dll : fatal error LNK1120: 15 unresolved externals
30>  -------- End Detailed Actions Stats -----------------------------------------------------------
30>ERROR : UBT error : Failed to produce item: D:\Git\UnrealEngine4.11\Engine\Plugins\Runtime\NWheeledVehicles\Binaries\Win64\UE4Editor-NWheeledVehicles.dll
30>  Total build time: 7,61 seconds


I have found the cause! I was including “AnimGraph” as module dependency, but it should be “AnimGraphRuntime”