Collision – picking up objects using Overlap

Item pickup is a pretty important thing to get down cleanly. In this recipe, we'll outline how to get item pickups working using Overlap events on Actor Component primitives.

Getting ready

The previous recipe, Collisions: Letting Objects pass through each other using Ignore, describes the basics of collisions. You should read it for background before beginning this recipe. What we'll do here is create a New Object Channel... to identify Item class objects so that they can be programmed for overlaps only with the player avatar's collision volume.

How to do it...

  1. Start by creating a unique collision Channel for the Item object's collision primitive. Under Project Settings | Collision, create a new Object ...

Get Unreal Engine 4 Scripting with C++ Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.