I’m creating a RTS, in this I would like to make a selection of character on screen, I would draw a rectangle on screen and then have the system select all of the pawns within the rectangle box.
My problem is the rectangle is made in 2D on the HUD like this:
Now I’m a little stuck on how to select the character in 3D. At the moment I have spawned a box collision at the centre point and the scaled it based on size of the rectangle. This looks like this:
The inaccuracies you describe stem from not accounting for the viewing frustum. As in, the 2d rectangle is not representative of the corresponding trapezoid in 3d space.
I’m having trouble implementing it with my present set up. I have got the "D begin and end of the selection but I can’t get it to return any of the actors in the selection.
Are you running this in the HUD class? It looks like you are not. You need to run this using the HUD’s draw call. You should be bombarded by warning messages in the output log.
It’s a unique feature of the HUD class as mentioned above, hence me uploading an example as it is a bit obscure. There are bits of functionality in the engine that require specific world context to run, this is one of them.