Hi everybody ,
Im starting using cinder library and I would like to
code a worldToScreen function which
gonna return me a vec3 ( woorld coordinate )
from the 2d Mouse
position on a gl::scopedViewport
How I consider
to solve this problem:
1-
Normalize the mouse position from -1 to 1 from the viewport
center
2- Calculate the right axis and up axis
relative to the viewport camera
3- Calculate the
projection boundaries ( in worldPos ) referring to the width and
height of the camera render plane along
the
target axis
4- Use the normalized mouse Position
, the right and up axis relative to camera and projection
boundaries to
get the woorld coordinate of the Screen
position.
I read this topic ,
but it seems to be outdated :
My main question : is there an
existing way from cinder to get the projection boundaries of the
viewport camera ?
My goal is to generate raycasting in
3d Space to trigger colliders
I insert a picture to give me more clarity
about my idea to code this algorithm
Any suggestion will be appreciated