Quote:
I don't WANT that. I want to know how to change a vertice's coordinates to my cursor click VISUALLY no matter what rotations are going on.
If i understand right you have:
- 3d objects in world coordinates,
- you want to select one vertice using the mouse.
- you have the selected vertice in world coordinate, so you already have the initial x,y,z position of selected vertice.
- Now you want to move that vertice to a new x,y,z position in world coordinates using the mouse...and for doing that you want to convert your mouse 2d screen coordinate into equivalent 3d world coordinate...and that is where your are wrong about your aproach...you cant do that.
You see, you can take any 3d coordinate and calc the equivalent 2d screen coordinate, several 3d coordinates can result in the same 2d coordinate when converted, (that is why there is a thing called Zbuffer which tells what 3d coordinate will actually paint the pixel in the screen); however you CAN NOT take any 2d screen coordinate and calc the equivalent 3d coordinate, becouse you dont know how depth into the screen you are "meaning" with your mouse...well except when you are asuming how depth into the screen your are.
Most 3d modelling programs works using the tipical 4 windows view for modeling:
- FRONT. How the objects looks when seen the front, the mouse is used for update the X,Y coordinate of any selected vertice, the Z cordinate remain unchanged when the user works in that view.
- TOP. How the object looks when seen from above (top down view), the mouse is used for update the X,Z coordinate of any selected vertice, the Y coordinate remain unchanged when the user works in that view.
- LEFT. How the object looks when seen the left, the mouse is used for update the Y,Z coordinate of any selected vertice, the X coordinate remain unchanged when the user works in that view.
- Perspective. Actual 3d view of the objects in perspective, some programs use this view just for show how the objects looks, but not for updating vertices; however some programs allow to updated vertices in perspective using a switch, when selected mouse update x,y, another switch meanmouse update yz and so on.
good luck.