0

I have a perspective projection. I want to have an object follow the mouse. It works fine when I set the object to be almost on a near clipping plane. But as the object goes beyond the near clipping plane, its movement is more and more distorted in a comparison to the mouse position. I know I need to change X and Y coordinates to reflect modified Z, but I don't know exact equation.

4

1 に答える 1

1

ビューポートの制限はニア プレーンにマッピングされるため、ニア プレーンに近い場合のスケーリング係数は ~1 です。したがって、ニア クリッピング プレーンの距離に関連して、ビュー座標内のオブジェクトの距離によってスケーリングするだけです。

scale = Z_object / Z_near
于 2012-04-19T10:09:50.830 に答える