Home › Concepts › Source Info

Source Info

How the framework keeps interactable objects independent of the player.

The Source Info struct and where it originates
diagram_sourceinfo.svgThe Source Info struct and where it originates
The Source Info struct and where it originates

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

Tip

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.