Source Info
How the framework keeps interactable objects independent of the player.
The problem it solves
If a grabbable object asks "which hand grabbed me?", it has to know about hands — and then it only works in VR. If it asks "who selected me?" and the answer is a pawn class, it only works with that pawn.
The struct
ST_SourceInfo carries three things: the pawn that acted, the component that acted, and the
component's identifier name. It is produced by BPI_SourceInfo.getSourceInfo, which all three
ability base classes implement.
Every interaction call takes it as a parameter. A target therefore knows exactly who acted on it, with enough detail to distinguish left hand from right, without ever referencing a pawn or controller class.
Using it
FL_Haptics.Haptics_Effecttakes Source Info and plays on the correct hand automatically.getSidesFromAbilityresolves Source Info to one hand or both.- The identifier lets you distinguish, for example, a fingertip overlap from a whole-hand overlap using
Allowed IdentifiersonBPC_Interaction_Overlap.
When you write your own interaction, take Source Info as a parameter even if you do not need it yet. It costs nothing and it is the difference between an interaction that works on one platform and one that works on all three.