diff --git a/Handbook/src/appendix/changelog.md b/Handbook/src/appendix/changelog.md index f6453761..4c85be98 100644 --- a/Handbook/src/appendix/changelog.md +++ b/Handbook/src/appendix/changelog.md @@ -94,6 +94,7 @@ This is a minor release focusing mainly on bringing OpenXR-compatible hand track - The new OpenXR animation system now takes into account the mesh bone's transforms for a more reliable hand animation. - FSGDebugVirtualHand::Draw now accepts a FXRMotionControllerData parameter instead of all WristLocation, WristRotation, JointPositions, and JointRotations parameters. - FSGDebugVirtualHandSettings has been renamed to FSGVirtualHandDebuggingSettings. +- The value for USGGrabComponent's AttachmentSocketName uproperty now defaults to the value of the plugin's GrabAttachPointSocketName instead of Name_NONE. - Updated the Directory Structure section of the main README file to reflect the latest toolchain support status. - The `/CHANGELOG.md` file has been migrated to `/Handbook/src/overview/changelog.md` - The `/LICENSE.md` file has been migrated to `/Handbook/src/license/senseglove-unreal-engine-plugin.md` diff --git a/Handbook/src/getting-started/setup-grab-release-system/README.md b/Handbook/src/getting-started/setup-grab-release-system/README.md index 57ef5fda..1e55ab3e 100644 --- a/Handbook/src/getting-started/setup-grab-release-system/README.md +++ b/Handbook/src/getting-started/setup-grab-release-system/README.md @@ -18,6 +18,11 @@ Setting up the SenseGlove Grab/Release System involves two main steps. The first > property prefixed with `Detachment` is a parameter directly passed to > Unreal's `FDetachmentTransformRules` during the release process. +> [!CAUTION] +> If `AttachmentSocketName` is unspecified, or incorrect the grabbable object +> will be attached to the root bone of the virtual hand mesh, which probably is +> not ideal. + 4. A key setting for the release system is located within your [`SGPawn`](../setup-senseglove-default-classes/sgpawn.md) instance. In the `Details` panel for your `SGPawn`, find the `Max Number of Hand Velocity Samples` setting and adjust it according to your needs. This setting determines the velocity of objects released from the hands by averaging the specified number of frames. Optimizing this value depends on the framerate of your simulation at runtime. ![Setting up the Grab/Release System - Max number of hand velocity samples on release](release-max-velocity-samples.png "Setting up the Grab/Release System - Max number of hand velocity samples on release") diff --git a/Source/SenseGlove/Private/SenseGlove/Components/SGGrabComponent.cpp b/Source/SenseGlove/Private/SenseGlove/Components/SGGrabComponent.cpp index b19e11c4..65c1726d 100644 --- a/Source/SenseGlove/Private/SenseGlove/Components/SGGrabComponent.cpp +++ b/Source/SenseGlove/Private/SenseGlove/Components/SGGrabComponent.cpp @@ -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;