How could I do this?

Hi I would like to create a game in which there are buildings that you can destroy. I would like to be able to place targets on the walls of these buildings and then a plane will come and throw something to the target to destroy the building. The problem is that I don’t know how to place a target with the mouse cursor, which kind of snaps to the wall

You should be able to take advantage of these:

If you’re new to all this, consider reading up about [how collision works][2] in UE4.

You can use Location (or ImpactPoint - depends how the game mechanic is supposed to be like) and Normal to place a decal or attach a static mesh that serves as the target for the place.

Yes I’m completely new to unreal engine so could you try to explain how this blueprint works pls?

Let’s say each of your buildings is an actor with a static mesh (destructible).

Using the above-mentioned code in the controller will allow you to click on actors in the world and get information about them. If the clicked actor belongs to the type defined on the far left, the GetHitUnderCursorForObjects will spit out a HitResult with all the info that you need.

Use that information to place targets on the building where the user clicks. You will need to Enable Click Events in the controller for this to work.

Something like this could be a start:

https://gyazo.com/4c0836e19a40d500b543d0907112ce69

I didn’t understand the SpawnActor Target with the SET.
PS:Thank you a lot for taking your time to explain me

It’s an object reference. If you spawn something dynamically in the world and want to interact with it later on, you need a handle - object reference. Right click on the Return Value pin and Promote - this will create the correct variable which will store (SET) the reference to the object.

For example: when you destroy the building, you will most likely need to destroy the Target object, too. Now that you have a reference to it, you can.

Thank you a lot for helping me and taking your time to explain how this works :wink: