I’m attempting to write some flight physics in a AsyncPhysicsTick, and the following works:
However, I can’t figure out how to make the same work in C++.
I’m able to have the code above run on an Actor, but I can’t figure out how to AddForce or AddImpulse.
In a previous experiment, I attempted to use a Primative movement component to put the logic there, and while I --thought-- I found a way to correctly call things:
I ended up with compilation errors that I wasn’t able to understand:
FlightModelComponent.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) private: static unsigned int & __cdecl TThreadSingleton<class Chaos::FPhysicsThreadContext>::GetTlsSlot(void)" (__imp_?GetTlsSlot@?$TThreadSingleton@VFPhysicsThreadContext@Chaos@@@@CAAEAIXZ) referenced in function "public: virtual void __cdecl UFlightModelComponent::AsyncPhysicsTickComponent(float,float)" (?AsyncPhysicsTickComponent@UFlightModelComponent@@UEAAXMM@Z)
Display LogLiveCoding FlightModelComponent.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl Chaos::FPhysicsThreadContext::FPhysicsThreadContext(void)" (__imp_??0FPhysicsThreadContext@Chaos@@QEAA@XZ) referenced in function "public: static class FTlsAutoCleanup * __cdecl UE::Core::Private::Function::TFunctionRefCaller<class `public: static class Chaos::FPhysicsThreadContext & __cdecl TThreadSingleton<class Chaos::FPhysicsThreadContext>::Get(void)'::`2'::<lambda_1>,class FTlsAutoCleanup * __cdecl(void)>::Call(void *)" (?Call@?$TFunctionRefCaller@V<lambda_1>@?1??Get@?$TThreadSingleton@VFPhysicsThreadContext@Chaos@@@@SAAEAVFPhysicsThreadContext@Chaos@@XZ@$$A6APEAVFTlsAutoCleanup@@XZ@Function@Private@Core@UE@@SAPEAVFTlsAutoCleanup@@PEAX@Z)
Display LogLiveCoding FlightModelComponent.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl Chaos::FPhysicsThreadContext::~FPhysicsThreadContext(void)" (__imp_??1FPhysicsThreadContext@Chaos@@UEAA@XZ) referenced in function "public: virtual void * __cdecl Chaos::FPhysicsThreadContext::`scalar deleting destructor'(unsigned int)" (??_GFPhysicsThreadContext@Chaos@@UEAAPEAXI@Z)
Display LogLiveCoding FlightModelComponent.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl Chaos::SetObjectStateHelper(class IPhysicsProxyBase &,class Chaos::TPBDRigidParticleHandleImp<double,3,1> &,enum Chaos::EObjectStateType,bool,bool)" (__imp_?SetObjectStateHelper@Chaos@@YAXAEAVIPhysicsProxyBase@@AEAV?$TPBDRigidParticleHandleImp@N$02$00@1@W4EObjectStateType@1@_N3@Z) referenced in function "public: virtual void __cdecl UFlightModelComponent::AsyncPhysicsTickComponent(float,float)" (?AsyncPhysicsTickComponent@UFlightModelComponent@@UEAAXMM@Z)
Display LogLiveCoding FlightModelComponent.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl Chaos::FRewindData::MarkDirtyFromPT(class Chaos::TGeometryParticleHandleImp<double,3,1> &)" (__imp_?MarkDirtyFromPT@FRewindData@Chaos@@QEAAXAEAV?$TGeometryParticleHandleImp@N$02$00@2@@Z) referenced in function "public: virtual void __cdecl UFlightModelComponent::AsyncPhysicsTickComponent(float,float)" (?AsyncPhysicsTickComponent@UFlightModelComponent@@UEAAXMM@Z)
Display LogLiveCoding D:\round2\vr_office\Binaries\Win64\UnrealEditor-vr_office.patch_6.exe : fatal error LNK1120: 5 unresolved externals
So my question is, what struct or class do I use to apply force or impulse? Do i get a reference to the root component and then apply it there? Thank you in advance.