Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have a delta in screen coordinates that I want to transform to a 3d delta in world space.

The delta is in this case a movement across the (x,y) coordinates in screen space on the near projection plane for a known z in the 3d space. The goal is to move an object in 3d space horizontally and vertically.

How would I do this?

I guess it has something to do with getting rid of the translation component in the world-view-projection matrix, as the delta is only influenced by the scaling and rotation part of the matrices.

I tried the naive approach by setting the translation component in the world-view-projection matrix to 0, but that did not work.

The only working solution i found so far is to unproject the (0,0,z) coordinate of the object to world space and then unproject the delta (x,y,z) to world space. The result of these 2 un-projections is then substracted to get the delta in world space.

share|improve this question
1  
Your question doesn't make a lot of sense. I guess you are working in 3D, and by delta you mean some form of difference (vector? distance?). Basically a screen coordinate translate into a line in 3D space, in some cases it makes sense to do a line pick along that line to find what item the player sees at that point, but otherwise there is no inherent way of transforming screen coordinates to world coordinates. –  eBusiness Dec 27 '12 at 15:15
    
thanks for your comment, I will update my question to make it clearer. –  pivotnig Dec 27 '12 at 15:17
1  
Your last paragraph sounds like you have a working solution, so what is your problem? –  eBusiness Dec 27 '12 at 15:36
    
thanks again for coming back to my question. I know that there must be a better solution, by using the homogenous coordinates of the world-view-projection matrix and disregarding the translation. My solution works, but I try to gain more knowledge about matrices and the tricks you can do with them. –  pivotnig Dec 27 '12 at 15:54
1  
Sounds like you are more in need of reading material than questions and answers. In any case, I'm still not sure what exactly it is you are doing, maybe you should spend some focus on your writing and then come back to the matrices later. –  eBusiness Dec 27 '12 at 16:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.