Hi!
I have a Widget Blueprint. In that Widget Blueprint I have a crosshair as an image. That crosshair image is then given anchors to the center, alignment (0.5, 0.5) and position X = 0.0 and position Y = -220.0. The result of this is a crosshair in the middle of the screen raised slightly.
I want to use this crosshair to aim at what I want to shoot at. So say the crosshair is over a box in the world, I then linetrace from the crosshair and hit the box, the location of the hit is where my weapon will target and shoot at. The issue I'm having is getting the location of the crosshair on the screen in order to do the linetrace. I COULD do it with hard-coded values but I don't want to hard-code such values. So my question is: How do I get the location of this crosshair dynamically? (resulting in a Vector2D)
I have a Widget Blueprint. In that Widget Blueprint I have a crosshair as an image. That crosshair image is then given anchors to the center, alignment (0.5, 0.5) and position X = 0.0 and position Y = -220.0. The result of this is a crosshair in the middle of the screen raised slightly.
I want to use this crosshair to aim at what I want to shoot at. So say the crosshair is over a box in the world, I then linetrace from the crosshair and hit the box, the location of the hit is where my weapon will target and shoot at. The issue I'm having is getting the location of the crosshair on the screen in order to do the linetrace. I COULD do it with hard-coded values but I don't want to hard-code such values. So my question is: How do I get the location of this crosshair dynamically? (resulting in a Vector2D)
Comment