3d vertex translated onto 2d viewport

Posted by Dan Leidal on Game Development See other posts from Game Development or by Dan Leidal
Published on 2012-11-01T14:56:19Z Indexed on 2012/11/01 17:18 UTC
Read the original article Hit count: 314

Filed under:
|
|
|

I have a spherical world defined by simple trigonometric functions to create triangles that are relatively similar in size and shape throughout.

What I want to be able to do is use mouse input to target a range of vertices in the area around the mouse click in order to manipulate these vertices in real time.

I read a post on this forum regarding translating 3d world coordinates into the 2d viewport.. it recommended that you should multiply the world vector coordinates by the viewport and then the projection, but they didn't include any code examples, and suffice to say i couldn't get any good results.

Further information.. I am using a lookat method for the viewport. Does this cause a problem, and if so is there a solution? If this isn't the problem, does anyone have a simple code example illustrating translating one vertex in a 3d world into a 2d viewspace?

I am using XNA.

© Game Development or respective owner

Related posts about 2d

Related posts about 3d