C#XNA鼠标的位置投射到3D平面 [英] C# XNA Mouse position projected to 3D plane

查看:128
本文介绍了C#XNA鼠标的位置投射到3D平面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个3D XNA项目,我一直在思考这个问题像2周。 于是我就决定要问你。

I'm working on a 3D XNA project, and I've been thinking about this problem for like 2 weeks. So I just decided to ask you.

基本上我有一个平面上,我想突出鼠标的位置,以那架飞机,但如何? 我试了很多办法做到这一点,计算的角度... 但我要指出,该距离必须作用于X位置,也许一些数学需要的是什么我以前从来没有听说过。

Basically I have a flat plane and i want to project the mouse position to that plane, but how? I tried many ways to do it, calculated angles... But i figured out, that the distance must effect on the X position, maybe some math is needed what I've never heard before.

感谢您的时间。

推荐答案

在这里,您可以观看完整的源$ C ​​$ C样品做你想要什么......

Here you can watch a full source code sample doing what you want....

http://www.youtube.com/watch?v=axHp1f3RlHM

据计算在康拉德做......但光线交叉与一个平面物体做...没有优化,更容易理解如何做同样的方式曙光。

It calculates a ray in the same way that konrad do... but the ray intersection is done with a plane object... without optimizations and easier to understand how is done.

这篇关于C#XNA鼠标的位置投射到3D平面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆