I am working on a tower defense game and I want to be able to use the cursor to destroy the actor when the right mouse button is clicked. I was thinking of restricting this to only being able to destroy the tower actors that i choose using cast to nodes just so the player cannot destroy anything that they shouldn’t be able to. Regardlessly i can’t seem to get this working so if anyone could help me that would be great.
Below is a screenshot of the tower actors i wish to be able to destroy if that helps.
In your player controller:
“Get Hit Result Under Cursor By Objects” → Cast other actor to your parent tower BP → Destroy Actor
And that’s already it.
Is this along the right lines?
i can’t hook things up
when I try to connect the as archermaster to the target i get that their not compatible.
First of all you have to break the hit result. That’s a struct containing tons of great information.
Part of it is “Hit Actor” or “Other Actor”. Those terms are used to describe the same thing around unreal. In this case the actor you clicked on.
Plug that one into the “Object” pin and the result of the cast into “Destroy Actor”.
Thank you very much this works perfectly. You have helped greatly