Implementing the Pickup and Drop functions
Now that we've added this interface to the BP_PickupCube
class, we can implement the functions we declared in that interface in our event graph. Let's get started:
- In your
Event Graph
, right-click and selectEvent Pickup
 to create a Pick up event. This event exists on this Blueprint class now because we've attached an interface that declares it. You'll see that the event indicates that it's an interface event fromBPI_PickupActor
. - Create a
Drop
event in the same way.
Now that we've created handlers for the two events coming from our interface, let's make them work.
When this object is picked up, we want to turn off its physics simulation so that it doesn't fall out of our hand, and we want to attach it to a scene component on the hand that's picking it up.
- Drag a reference to the
Static Mesh Component
onto theEvent Graph
. - Call
Set Simulate Physics
on it, settingSimulate
toFalse
. - Right-click in the graph and select
Get Root Component
. - Drag a connector...