<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/249" />

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2006-02-25T16:20:29+00:00</updated>

	<author><name><![CDATA[Real-Time Physics Simulation Forum]]></name></author>
	<id>https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/249</id>

		<entry>
		<author><name><![CDATA[Robert Isele]]></name></author>
		<updated>2006-02-25T16:20:29+00:00</updated>

		<published>2006-02-25T16:20:29+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=742#p742</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=742#p742"/>
		<title type="html"><![CDATA[Novodex Raycasting Troubles]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=742#p742"><![CDATA[
You ll need to project the mouse position and direction back from screen space to world space! Here's an example how I do it in my app:<br>(pos=ray origin; dir= direction)<br><div class="codebox"><p>Code: </p><pre><code>float mouseX = (float)NativeMethods.LoWord((uint)lParam.ToInt32());float mouseY = (float)NativeMethods.HiWord((uint)lParam.ToInt32());Matrix matProj = App.ProjectionMatrix;Matrix matView = App.ViewMatrix;Vector3 vScreen;vScreen.X = ((mouseX * 2f) / App.Device.Viewport.Width - 1f) / matProj.M11;vScreen.Y = -((mouseY * 2f) / App.Device.Viewport.Height - 1f) / matProj.M22;vScreen.Z = 1f;Matrix matViewInv = Matrix.Invert(matView);Vector3 dir = Vector3.TransformNormal(vScreen, matViewInv);dir.Normalize();Vector3 pos = new Vector3(matViewInv.M41, matViewInv.M42, matViewInv.M43);</code></pre></div><p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=430">Robert Isele</a> — Sat Feb 25, 2006 4:20 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Erwin Coumans]]></name></author>
		<updated>2006-02-24T19:10:35+00:00</updated>

		<published>2006-02-24T19:10:35+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=741#p741</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=741#p741"/>
		<title type="html"><![CDATA[Novodex Raycasting Troubles]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=741#p741"><![CDATA[
Looks like you need a proper unproject.<br><br>Please check this article, with demo/source:<br><a href="http://www.mvps.org/directx/articles/improved_ray_picking.htm" class="postlink">http://www.mvps.org/directx/articles/im ... icking.htm</a><br><br>If this doesn't help, did you already try this Novodex forum?<br><a href="http://www.novodex.com/forum/" class="postlink">http://www.novodex.com/forum/</a><br>Erwin<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=2">Erwin Coumans</a> — Fri Feb 24, 2006 7:10 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[jon]]></name></author>
		<updated>2006-02-24T18:53:53+00:00</updated>

		<published>2006-02-24T18:53:53+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=740#p740</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=740#p740"/>
		<title type="html"><![CDATA[Novodex Raycasting Troubles]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=740#p740"><![CDATA[
Hi,<br><br>I'm trying to do some raycasting in Novodex, so I can make the cube I click on with the mouse the selected actor.  I'm using DirectX, specifically Direct Input to get the mouse position (x,y,x).  Then my camera uses camerapoistion to specify position and PointCamera as the vector where the camera is pointing.  I know I probably need to use the Pointcamera somehow, possibly through DX3DMatrixLookAtH.  <br><br>Please can anyone point me in the right direction, or show me some code that  already has it working, my deadlines approaching .... Thanks Jon<br><br>orig = NxVec3(camerapoistion.x, camerapoistion.y, camerapoistion.z);<br>dir = NxVec3(mousepoisition.x, mousepoisition.y, mousepoisition .z );<br>NxRay ray(orig, dir);<br><br>NxShape* closestShape = gScene-&gt;raycastClosestShape(ray, NX_ALL_SHAPES, hit);<br>if (closestShape)<br>{ <br>gSelectedActor[0] = closestShape-&gt;getActor();<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=429">jon</a> — Fri Feb 24, 2006 6:53 pm</p><hr />
]]></content>
	</entry>
	</feed>
