<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.xna.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>XNA Framework</title><link>http://forums.xna.com/forums/56.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 0.0)</generator><item><title>Re: Unproject does not return correct results [XNA 2.0]</title><link>http://forums.xna.com/forums/thread/68470.aspx</link><pubDate>Fri, 13 Jun 2008 13:11:13 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:68470</guid><dc:creator>testi</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/68470.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=56&amp;PostID=68470</wfw:commentRss><description>The way I see it,&lt;strong&gt; the bug&lt;/strong&gt; I explained in the very first post of this topic &lt;strong&gt;still exists in XNA 3.0 CTP&lt;/strong&gt;.
&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: Looking at the reflected code, it seems that both methods divide by the the float number in the WithinEpsilon if clause. That seems definitly wrong, but multiplying only brings me closer to the correct result and does not return the correct one. Doing the experiment in the first post with a parallel projection matrix returns the correct result btw (I use that as a workaround for now).&lt;/p&gt;
&lt;p&gt;Has anybody tried to reproduce this? &lt;/p&gt;</description></item><item><title>Re: Unproject does not return correct results [XNA 2.0]</title><link>http://forums.xna.com/forums/thread/57724.aspx</link><pubDate>Thu, 17 Apr 2008 23:51:49 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:57724</guid><dc:creator>dexy</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/57724.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=56&amp;PostID=57724</wfw:commentRss><description>Thanks Zman,&lt;br&gt;I think I got the 404 because I wasn't logged in to connect at the time. I logged in then went searching for unproject manually.&lt;br&gt;I'll make a little repro example when I get a chance to demonstrate problems with unproject(). It will also contain my solution to the problem, which I have outlined in a post&lt;br&gt;&lt;a href="http://forums.xna.com/thread/57432.aspx"&gt;here. (http://forums.xna.com/thread/57432.aspx)&lt;/a&gt;&lt;br&gt;&lt;br&gt;The samples suffer from the problem, but because of the ray points being transformed by the object's world matrices, the problem is not so obvious. You can however see problems if you rotate the camera, while hovering over an object, in certain positions, intersections will not be recognised (and the label doesnt appear even though you are over an object).&lt;br&gt;&lt;br&gt;As I have mentioned before, I'm not going to rely on the Viewport.Unproject() being fixed, since I wrote my own unproject method, but I really think it should be fixed because I think anyone who tries using it is going to run into the same nightmare I did.&lt;br&gt;&lt;br&gt;-dexy&lt;br&gt;</description></item><item><title>Re: Unproject does not return correct results [XNA 2.0]</title><link>http://forums.xna.com/forums/thread/57699.aspx</link><pubDate>Thu, 17 Apr 2008 18:24:40 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:57699</guid><dc:creator>The ZMan</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/57699.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=56&amp;PostID=57699</wfw:commentRss><description>&lt;P&gt;Even if you cannot vote you should upload your repro case here is how &lt;A href="http://forums.xna.com/thread/1864.aspx"&gt;http://forums.xna.com/thread/1864.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;(you got the 404 becuase i think you need to be registered and logged into connect to see bugs)&lt;/P&gt;</description></item><item><title>Re: Unproject does not return correct results [XNA 2.0]</title><link>http://forums.xna.com/forums/thread/57102.aspx</link><pubDate>Mon, 14 Apr 2008 09:11:58 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:57102</guid><dc:creator>dexy</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/57102.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=56&amp;PostID=57102</wfw:commentRss><description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have just discovered the hard way that unproject doesn't return the right results... it seems to be missing a transform or something in there. My resulting mouse ray seems to always go through the origin (starting at the correct position, to an extent).&lt;/P&gt;
&lt;P&gt;I tried using the connect link to vote (above) but I got a page not found.&lt;/P&gt;
&lt;P&gt;I think it might be time to pull out my old matrix class and try and get its unproject working... Unless the xna unproject can be fixed..?&lt;/P&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;static&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Vector3&lt;/FONT&gt;&lt;FONT size=2&gt; Unproject(&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Camera&lt;/FONT&gt;&lt;FONT size=2&gt; camera, &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Vector3&lt;/FONT&gt;&lt;FONT size=2&gt; screenSpace)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt; camera.Viewport.Unproject(screenSpace, camera.ProjectionMatrix, camera.ViewMatrix, &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Matrix&lt;/FONT&gt;&lt;FONT size=2&gt;.Identity);&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;}&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT color=#2b91af size=2&gt;Vector3&lt;/FONT&gt;&lt;FONT size=2&gt; screenNear = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Vector3&lt;/FONT&gt;&lt;FONT size=2&gt;((&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;float&lt;/FONT&gt;&lt;FONT size=2&gt;)x, (&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;float&lt;/FONT&gt;&lt;FONT size=2&gt;)y, 0f);&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Vector3&lt;/FONT&gt;&lt;FONT size=2&gt; screenFar = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Vector3&lt;/FONT&gt;&lt;FONT size=2&gt;((&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;float&lt;/FONT&gt;&lt;FONT size=2&gt;)x, (&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;float&lt;/FONT&gt;&lt;FONT size=2&gt;)y, 1f);&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Vector3&lt;/FONT&gt;&lt;FONT size=2&gt; worldNear = Unproject(camera, screenNear);&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Vector3&lt;/FONT&gt;&lt;FONT size=2&gt; worldFar = Unproject(camera, screenFar);&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Vector3&lt;/FONT&gt;&lt;FONT size=2&gt; direction = worldFar - worldNear;&lt;/P&gt;
&lt;P&gt;direction.Normalize();&lt;/P&gt;&lt;FONT size=2&gt;
&lt;P&gt;linee.Start = worldNear;&lt;/P&gt;
&lt;P&gt;linee.End = worldNear + (direction * 1000f);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in theory the line that this code draws should be invisible, under the mouse cursor. Instead, it can be seen to always pass through the origin.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-dexy&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description></item><item><title>Re: Unproject does not return correct results [XNA 2.0]</title><link>http://forums.xna.com/forums/thread/38273.aspx</link><pubDate>Thu, 20 Dec 2007 11:52:06 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:38273</guid><dc:creator>ajmiles</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/38273.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=56&amp;PostID=38273</wfw:commentRss><description>&lt;P&gt;&lt;A href="https://connect.microsoft.com/feedback/ViewFeedback.aspx?FeedbackID=318306&amp;amp;SiteID=226"&gt;https://connect.microsoft.com/feedback/ViewFeedback.aspx?FeedbackID=318306&amp;amp;SiteID=226&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;You'll need to login to your passport account to be able to vote.&lt;/P&gt;</description></item><item><title>Re: Unproject does not return correct results [XNA 2.0]</title><link>http://forums.xna.com/forums/thread/38267.aspx</link><pubDate>Thu, 20 Dec 2007 10:59:46 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:38267</guid><dc:creator>testi</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/38267.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=56&amp;PostID=38267</wfw:commentRss><description>I actually read the other thread before writing this, but it seemed like the author was satisfied with his result and I didn't if both issues are actually the same.&lt;br&gt;How can I vote for a connect issue?&lt;br&gt;</description></item><item><title>Re: Unproject does not return correct results [XNA 2.0]</title><link>http://forums.xna.com/forums/thread/38260.aspx</link><pubDate>Thu, 20 Dec 2007 10:11:18 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:38260</guid><dc:creator>ajmiles</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/38260.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=56&amp;PostID=38260</wfw:commentRss><description>&lt;P&gt;There's another thread in the forum claiming perhaps that the changes to Unproject have made it inconsistent/buggy:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://forums.xna.com/thread/36985.aspx"&gt;http://forums.xna.com/thread/36985.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I believe too there is now a connect issue filed against this, so I would recommend voting on it (unless you're the person that filed it, in which case I'm sure it'll be looked into when everyone is back at work properly in the new year.&lt;/P&gt;</description></item><item><title>Unproject does not return correct results [XNA 2.0]</title><link>http://forums.xna.com/forums/thread/38255.aspx</link><pubDate>Thu, 20 Dec 2007 08:39:55 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:38255</guid><dc:creator>testi</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/38255.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=56&amp;PostID=38255</wfw:commentRss><description>Hello,&lt;br&gt;&lt;br&gt;there is something wrong with Unproject in XNA 2.0. I used it in my XNA 1.1 code and everything worked like expected. In XNA 2.0 it was reimplemented in c# and it seems like something went wrong. It doesn't work properly!&lt;br&gt;&lt;br&gt;Here is a very basic example that shows that:&lt;br&gt;&lt;br&gt;Vector3 a = m_viewport.Project(new Vector3(&lt;b&gt;0.4f, 0.3f, 0.2f&lt;/b&gt;), m_projection, m_view, Matrix.Identity);&lt;br&gt;Vector3 b = m_viewport.Unproject(a, m_projection, m_view, Matrix.Identity);&lt;br&gt;&lt;br&gt;b should now contain &lt;b&gt;0.4, 0.3, 0.2&lt;/b&gt;, but it doesnt! The results are way off.&lt;br&gt;&lt;br&gt;Here are the matrix values copied from the immediate window before doing the Project call:&lt;br&gt;m_projection&lt;br&gt;{M11:0,9395257 M12:0 M13:0 M14:0} &lt;br&gt;{M21:0 M22:1,732051 M23:0 M24:0}&lt;br&gt;{M31:0 M32:0 M33:-1,001001 M34:-1}&lt;br&gt;{M41:0 M42:0 M43:-0,1001001 M44:0} &lt;br&gt;&lt;br&gt;m_view&lt;br&gt;{M11:1 M12:0 M13:0 M14:0} &lt;br&gt;{M21:0 M22:1 M23:0 M24:0}&lt;br&gt;{M31:0 M32:0 M33:1 M34:0}&lt;br&gt;{M41:0 M42:0 M43:-8 M44:1}&lt;br&gt;&lt;br&gt;Here is how these were created:&lt;br&gt;&lt;br&gt;m_view = Matrix.CreateTranslation(-m_position) * Matrix.Transpose(Matrix.CreateFromQuaternion(m_rotation));&lt;br&gt;&lt;br&gt;fieldOfView = (float)Math.PI / 3f;&lt;br&gt;aspectRatio = (float)m_viewport.Width / m_viewport.Height; // 1.8&lt;br&gt;nearPlaneDistance = 0.1f;&lt;br&gt;farPlaneDistance = 100f&lt;br&gt;m_projection = Matrix.CreatePerspectiveFieldOfView(fieldOfView, aspectRatio, nearPlaneDistance, farPlaneDistance);&lt;br&gt;&lt;br&gt;&lt;br&gt;Maybe somebody from the XNA team or a forum member can reproduce this for verification.&lt;br&gt;&lt;br&gt;Any help is greatly appreciated - thanks.&lt;br&gt;&lt;br&gt;&lt;br&gt;</description></item></channel></rss>