ATriggerVolume vs ATriggerBase

Hi, this is not really a help request, it’s more like a help for others who may run into the same problem.

I’m following lecture 108 - Trigger Volume of the Unreal C++ course (I’m using version 4.25 of the engine). I followed the instructions and for some weird reason I’m unable to link my TriggerBox to the door component. Here’s a screenshot of the situation:

As you can see, the code is ok and still I can’t select anything. I did a bit of research and discovered that ATriggerVolume is not in the class hierarchy of ATriggerBox (the object we dropped into the scene) - maybe only in the last version of the engine. So obviously the editor doesn’t list the pressure plate in the drop down menu.

I solved this by redefining the pointer as a ATriggerBase pointer (highest class in the hierarchy before AActor) and it worked. So I suggest to the creators of the course to warn about this with a little edit or note.

PS: I know I’m a psychotic optimizer and this course is aimed also to people who aren’t familiar with C++, but instead of including the header for ATriggerBase/ATriggerVolume, it would be more efficient to declare class ATriggerBase; or class ATriggerVolume; at the very beginning since, as we are using only a pointer in the header, the compiler doesn’t need all the info about those classes. This seems to not bother the engine and is a simple way to speed up compilation time.

The object dropped into the scene was “Trigger Volume” not “Box Trigger”.

Sorry, I completely missed that while working on code on a second monitor. I probably came back and saw Box Trigger selected and assumed ATriggerBox was a class derived from ATriggerVolume. By the way, what’s the difference between the two as they seem, at least for the use we are making of them in the tutorial, very similar (same methods, so I didn’t have to change any code apart from headers and the member declaration)?

Not a whole lot really. See here:

What are the differences between a Box Trigger and Trigger Volume?

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms