Download: WarpedRectange.rbxl (66.3 KB)
Just press play and mess around for a bit
Alright, on with the post:
This is what I see:
Notice in the bottom right, the selection box:
https://i.gyazo.com/94c983bbf9e8441fcde2795c717ac997.mp4
For each corner of the selection box, using camera:ScreenPointToRay(x,y)
I create a long edge part that shows the corner of my view:
You’ll notice the black shape. That’s just a regular square-based pyramid made by union-ing four corner wedges. I then get the: center of the four ends, of those rays. that were the corners of selection box, get the camera’s position, and set the cframe to in between those two.
I thought this would work, but I didn’t anticipate the warping that happens:
the resulting “rectangle” as viewed from the top when flattened:
The reason I’m doing all this is because I want to create a selection tool for roblox, and the method I’ve decided to use is workspace:GetPartsInPart()
. It’s the most performant option I’ve found, and I know it works because I used it for a digital camera in one of my projects. The camera was in the center, therefore no warping.
I’ve been suggested to create 8 corners for each part in the workspace, a workspace with models of potentially thousands of parts, and they constantly change, move, more get added, etc.
I just don’t see how that won’t cause me to run at 10 fps every time my selection tool is out.
Any other methods of selection I could potentially use? Maybe only doing the center of each part instead of 8 corners, or maybe I can create my view pyramid out of multiple parts somehow…
Either way, please leave suggestions.
Thanks!