ive watched many Blueprint Tutorials and played a little bit with Blueprint.
So i startet a Blueprint Sidescroller and activated Mouse Look via Blueprint.
But my Problem is, that the spawned elements are not spawned at the Mouse Location.
I really tried a view things but i cant help myself
Here is what i got.
Activate Mouse Look
In my PlayerController i added this things.
I think (no i know it is wrong) but i cant find the answer.
get mouse position gives you the screen coordinates, not the ones in 3d space. you would have to utilize gethitresultundercursor to achieve what you want.
I guess you just want to set the Y component of the impact point to the one of the GetPlayerController->GetControlledPawn->GetActorLocation ? So, break vector of the Impact-Point, make vector and set Y to the Y component of the pawn?
i just want to set X and Y for the Mouse click to the Actor.
At the Moment when i click i get 3D Coordinates and thats right for now, but for a 2.5D Sidescroller its not really good to Shoot in other location.
So i have to set the Mouse Click in front of the actor.
as you see at my screenshot above, after i press the mouse button the wallsconse spawns in the 3D Dimension not really infront of the Actor, but that is what i need.
Yeah, i know, you have the depth information too, and that is not what you want. You want everything to spawn at the same depth where the player is. And thats exactly what i described.
I was able to get this working by using a blocking volume behind the x axis location that the player moves on. Set that blocking volume to block all so it will consume the mouse click instead of the click going into open space. Part of what is happening is that the wall in the background is too far away for the mouse click to effectively register on it. So placing the blocking volume allows you to click and get the hit result. Additionally, you will want to break your impact result and use that to get the Y,Z of the Set Actor Location node, and use the Actor Location X value for the X. Use the Impact Point location for your make transform. This seems to work pretty well on my end, please let me know if this works for you!
Actually I figure something out without work around in another thread, there is simpler way to do this.
basically when you click, hit result is using the camera to trace location.
Using a cheat is not ideal, try again and see if you can pull it off without cheating.
here is a simple graph(I listed the nodes I used in image):
I forgot to annotate blue thing, blue dot is where your camera is, blue line is something like a camera near clipping plane.
This is a top down view of a side scroller template.