Who would have thought that clicking on something in 3D is such a pain? Well, let this extension fix you right up.
What is UBG 2D3D Translator?
UBG 2D3D Translator is a redesign of my extremely old Mouse 3D Interaction extension. This time it is designed for GameMaker: Studio 2 and provides better shape support. It gives you the ability to monitor multiple view ports and translate data between 2D space and 3D space (and back) thus providing you with tools to click on 3D objects and project 3D points onto a 2D HUD.
What Does This Extension Provide?
This extension provides you with a means to create a "translator" that will act as an intermediary from one space to another. It can either generate a 3D ray from a 2D point or a 2D point from a 3D point.
Also included are several ray / shape intersection scripts to allow you to check things like mouse position against triangles, blocks, or even vbuffer meshes. You are also provided a way to project your ray onto an infinite plane for things like 3D object placement.
In the case of mesh detection, not only does it automatically check bounding-box collisions first for speedier detection but it provides extra data such as the specific triangle ids and coordinates that were intersected.
Do I Have To Change My Rendering System For This?
Not at all! The translator does requires that you provide your renderer's projection matrix, view matrix, and active viewport. As such, you will need to have your camera data accessible but past this it doesn't change or affect the rendering system at all.
Everything is written in native GML that is compatible with all platforms. GMS2 specific language features are used so this is not compatible with GMS1.4.
Also free to use and access is the online documentation for the extension.
Lastly, if you have any questions, feel free to contact me!
End User Licence Agreement (EULA).