use the value of GrabAttachPointSocketName from the plugin settings as default for USGGrabComponent's AttachmentSocketName uproperty

This commit is contained in:
Mamadou Babaei
2024-08-16 18:02:19 +02:00
parent 551eca3985
commit db2c11079c
3 changed files with 16 additions and 1 deletions
@@ -37,12 +37,21 @@
#include "GameFramework/Actor.h"
#include "SGSettings/SGSettings.h"
struct USGGrabComponent::FImpl
{
/************************
* Static methods
************************/
FORCEINLINE static const FName& GetDefaultGrabAttachPointSocketName()
{
const USGSettings* Settings{USGSettings::GetInstance()};
const FName& SocketName{Settings->GetVirtualHandSettings().GrabSettings.GrabAttachPointSocketName};
return SocketName;
}
/************************
* Owner object
************************/
@@ -106,7 +115,7 @@ USGGrabComponent::USGGrabComponent(const FObjectInitializer& ObjectInitializer)
AttachmentScaleRule = EAttachmentRule::KeepWorld;
bAttachmentWeldSimulatedBodies = true;
AttachmentSocketName = NAME_None;
AttachmentSocketName = FImpl::GetDefaultGrabAttachPointSocketName();
DetachmentLocationRule = EDetachmentRule::KeepWorld;
DetachmentRotationRule = EDetachmentRule::KeepWorld;