5.4.Hand Socket Components
Hand socket components are an addition to the plugin as of 4.26. They are alternatives / work alongside having mesh sockets as snap points for grips.
For a long time I promoted that users make their own versions of these as they could bake in all of the game specific animation and interaction data they wanted into them then.
However I came into the realization that if I made a baseclass that wasn’t placeable and had to be subclassed that I could keep that same flexibility intact, while adding some very useful core logic.
Due to this, the HandSocketComponent isn’t directly placeable on an object, you need to create your own subclass for it first, then that subclass will be placeable (see below for the example templates subclass).
This setup ensures that users won’t cause a lot of pain in the future when they want some extra logic in the sockets that the core socket component doesn’t provide, they can simply add it to their base class. Some considerations of things that people may want to add include, multiple state based animations that can be queried, additional offsets, interaction tags and flags.
That being said, for the most basics of posing the hand socket component should be fairly good to use as is.
The interface now automatically queries for hand socket components as attached children when using the default GetClosestSocketInRange implementation, if using an override you can freely pass out the name and transform of a static one as well.
Once OnGrip is called, you can retrieve that socket component by checking for IsSlotGrip and then the secondary attachment state, finally querying with GetHandSocketComponentFromObject using the correct bone name and object reference (see below for the templates query).
The reason this node doesn’t just take in the grip info is in case you want to query for a socket component outside of a grip context.
Once you have the hand socket component you can retrieve mesh locations, socket locations, and mesh animations by casting to your base class.
Hand sockets have the following properties:
Hand Relative placement is the location of the mesh root to the actual hand socket. Generally in your base subclass this should be set to the same as your ingame hand to the motion controller so that aligning the hand socket components is easier. Then per spawned instance it can be further modified to tweak to your liking.
DecoupleMeshPlacement sets it so that moving the socket itself does not move your mesh placement. This lets you tweak the grip transform without editing the mesh placement that you have already set up.
OnlySnapMesh flags the interfaces default inplementation to ignore the transform of the socket component and pass out the grip controllers pivot transform only, then the hand socket is basically just providing a mesh placement.
For the pose and animation data I would suggest looking at the first glimpse video where I introduce this component.
Get Blended Pose Snap Shot will retrieve the core animation pose (if there is none then it will get the reference pose for the target mesh) and apply any bone delta rotations to it, then bake it into a pose snap shot and return to you.
Get Mesh Relative Transform will retrieve the wanted location of the mesh itself to the held object (in relative space), passing in the correct hand allows for the mirroring setting to work correctly.
Get Animation Sequence as Pose Snap Shot is a utility node to help you use the same workflow for things (even custom additional animations you add to your subclass). This way you can still pass static poses out as pose snapshots even if they aren’t native to this component. Keep in mind that if you want to scrub through an animation with multiple frames that you will need the actual core sequence instead.