I am creating a pointer
PxRigidDynamic* KinActor = Scene->getPhysics().createRigidDynamic(KinPose);
and want to later store the object as a TSharedPtr:
TSharedPtr<physx::PxRigidDynamic> KinActorData;
KinActorData = MakeShareable(new physx::PxRigidDynamic*(KinActor));
But I get a compiler error:
error C2440: 'initializing': cannot convert from 'physx::PxRigidDynamic **const ' to 'physx::PxRigidDynamic *'
note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
note: see reference to function template instantiation 'TSharedPtr<physx::PxRigidDynamic,0>::TSharedPtr<physx::PxRigidDynamic*>(const SharedPointerInternals::FRawPtrProxy<physx::PxRigidDynamic *> &)' being compiled
note: see reference to function template instantiation 'TSharedPtr<physx::PxRigidDynamic,0> &TSharedPtr<physx::PxRigidDynamic,0>::operator =<physx::PxRigidDynamic*>(const SharedPointerInternals::FRawP
trProxy<physx::PxRigidDynamic *> &)' being compiled
error C2439: 'TSharedPtr<physx::PxRigidDynamic,0>::Object': member could not be initialized
note: see declaration of 'TSharedPtr<physx::PxRigidDynamic,0>::Object'
What is the correct way to assign a C++ pointer to a TSharedPtr?