Spawn actor where player is aiming?

I am trying to make it so the player can spawn a block where the player is aiming, I have the block setup as an actor and I know how to listen to mouse click events but I am not quite sure on the maths behind getting the transform to place the actor, could someone help?

Make a line trace and use the hitpoint for the position of the spawn.

Start: For example the camera position. That would be actor location of your character + the z height of your camera.

End: The Startvalue + the forward vector of your camera or player * length of the trace.

The you would take the hitresult, break it and use the hitlocation for the spawn location.

Brilliant! that worked :slight_smile: