Advertisement

project points to a plane using camera's right vectors

Started by September 12, 2022 09:47 AM
1 comment, last by cebugdev2 2 years, 1 month ago



I have a problem on how to represent or compute the rendering of some 3D handles in my game
My goal is to render something at the side of a graphical plane (not infinite) based on the right vector of the camera.

see this
In this drawing the camera is at the right side of the object,
I need to draw the two circles at the edge of the plane based on where my camera right vector is.

If I rotate the camera to say infront of the object it will look like this

Same if the camera is at the side

by the looks of it it is easy.
as i just need to get the look vector by subtracting camera position and object position, and cross vector with object's Up vector and I can get the right vector and display.

my problem is, if the Plane is tilted or rotated, Example like this
(front view)

if the above is front view and the plane is rotated in Z axis, i need to get the correct position of where to draw the two circles. I can get the ‘direction’ of this plane though, as this plane was drawn from a line and extruded so i have its normal, I just need to project the computed right vector based from the one i described above to this plane so that when i rotate the points are always inside that plane.

any one can help?

nvm, i found my solution after resting my eyes,
i need to use the plane normal cross product with the look (camera position - center) and i get my right vector I can use to position base on the plane's dimension. ?
I cant seem to delete a thread i created

This topic is closed to new replies.

Advertisement