#Thank you for responding. So I am using
1 messages · Page 1 of 1 (latest)
getting mouse clicks from the regular viewport isn't an issue - but getting it from where the screenCaptureComponent is capturing the scene from, is more complicated, and figuring out the math to do this is just beyond my grasp
its just a camera right?
I am using a technique to catch the 0-1 coords of my cursor over the display so I can tell where the cursor is relative to the image that it is howering over. But I don't know how to translate that into "real space" so that it will properly cast a ray from where that scene capture component is, and let me click on the element "that it is seeing" below
yeah sceneCaptureComponent is essentially a camera
it's a camera whose output can be printed to a texture (which is exactly wehat I am doing)
so from the camera u can just line trace straight out using its rotation?
well it needs to be offset depending on where the cursor is pointing out, relative to that camera
I can easily just shoot a line trace out from where that camera is, but it will currently only shoot toward only the center of that image (not accounting from where the cursor has moved)
have you split the struct pin of the deproject node for the screen position? May be a dumb question, but u had it question marked
it splits into an x and y
there are no dumb questions! I don't think I had
if you already have the right position, I can try to help u get those as well, idk ur whole setup, but u would probably need to get the buttons position and size so then ur mouse coordinates can be in local space of the button itself
well I took my X and Y of the cursor and joined them into a vector2D and plugged that into the screen position, but that dodn't do anything
so then if u can do that then you can take the starting vector for that line trace (the camera's location) then add X and Y values originating from mouse position multiplied by a scale value so that it can be used to offset the starting position of the line trace, then if u do that line trace it would be as if its coming from the camera but offset to the X or Y as if it were a screen and the center would be based on the mouse position at click.
not sure what the right scale value to multiply by would be though
..hang on
PC semi-crashing
here is what I am looking at
I dunno if I need that deproject screen to world then?
theres also convert mouse location to world space node
I havent done that exact thing before myself so I don't really know the answer just trying to help along with what makes sense to me
Yeah I see that, convert mouse space. thanks, this has been pretty frustrating
what's my Target?
says player controller
currently shooting nothing that I can see, hang on
yeah, this doesn't shoot any rays out of the origin. But I wouldn't imagine it would, since it doesn't have any link to the sceneCaptureComponent..
what do you mean when u said u want to click on elements in the top left display?
the buttons?
or the world objects?
ok so here is my UI element/overlay
these are UI buttons with screen captured textures om them
just make it 3 panels with the top left being the real world camera
from the sceneCaprtureComponents
then u can use the mouse to click on actors
well to do that, I need to shrink the viewport into a smaller image area, right? and offset it
Is this like when a character is using a screen? or is this how the main gameplay is designed?
these are what they look minimized (sorry, poor choice of wording I guess). Maximize means the other 3 are hidden and only one is visible & blown up to full size
ok so here we are half-way there.. I am shooting a ray directly into the center of what I am seeing in my quarter-display
I have hidden the other windows so the actual scene is visible beneath, and the red ray shooting down obviously
achieved by this
now I need to offset the end point somehow, by tracking where the cursor is relative to where it is hovering over the smaller display
I am able to capture the 2D info of the cursor (the XY pixel data) and normalize that to 0-1
I just need to undertsand how to convert that relative to where the cursor "would be floating" in space if it was actually where that cameraCapture component is
top left grey line is actually a cylinder (very long & thin) I have sticking out from the camera capture to compare with where I was expecting the line trace to hit. This was being used as a guide for something else previously, but it's just a debug tool
okay so now they are aligned?
yes
I was thinking you would do the opposite and make 3 panels and use one for the main camera
yes. it is shooting straight to the center of the camera's point of interest
So now you're trying to make it so you can get the hit result after clicking on the green mesh for example using the mouse from either the top left window or the main one?
just top left window, not worried about the main window.. that's currently showing just so I can see where the raycast is drawing (it won't show up in the render-to-texture image)
BRB feeding animals
ya so what if the xy from your top left window is used to offset the vector of the camera's location then a line trace is made from the center of that position out a distance to determine a hit result?
ok so my render texture (button canvas, essentially) is 930 wide by 512 high. I am able to get the cursor position with my MouseOver of it's widthPos X HeightPos, and then I normalize them both 0-1
it is basicallywhat I am doing here
that's what these values in black are showing when I click
x_____y
what are you clicking on?
and what happens?
then it draws that red ray, in the same location (always straight down the middle, for now) and gives me different values in the black console text, dpending on cursor placement
for left of the screen is closer to 0, far right is closer to 1
far bottom of screen is o, far top is 1. when I say screen, i mean this window/lit dislay area
display area
so if you click on the bottom right corner of that blue square, you take the x and y of the mouse and multiply that by a scale float, and take that number to use as X and Y offset for the camera's world location for the start of the next line trace.
actually i got that wrong. it's like this
0,0 top left. 1,1 bottom right. but same principal
principle haha
sure you can normalize it if u want
ok so how do I know what to multiply it by?
something like 10, 100, 1000 i dunno
anyway, feels like I am really close. Thanks for talking through this with me, I think it;s helped me get most of the way there. Just gonna keep futzing with it until I can figure out that secret sauce that is missing..