Hi, I’m trying to learn how to do things in c++. I have a blueprint that holds a static mesh of a minable rock. For now I just want to create a simple message when the rock is clicked so I know I can get it working.
So I added a c++ actor component to this blueprint and I’m trying to use delegates to know when it has been clicked. This is what I have so far, I’m not sure where to go from here. If it makes a difference I’m using the top down player controller starting project
If you want “clickable” as with the cursor, then there are already events for that.
Set the UI mode to “UI and game” and bind the “clicked” event on the object and you should be fine.
If you want “clickable” as in “when object is in the center of the screen, clicking will mine it,” then you have to cast a ray from the camera to detect collisions, or use a collision object (capsule, sphere, or slim box) on front of the camera, and when the mineable object enters this volume, turn on the ability to mine it with some flag in your controller and display the appropriate message in your HUD.