<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Maratis forum - Rayhit]]></title>
		<link>http://forum.maratis3d.com/viewtopic.php?id=522</link>
		<description><![CDATA[The most recent posts in Rayhit.]]></description>
		<lastBuildDate>Sun, 13 Oct 2013 17:08:23 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Rayhit]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=5500#p5500</link>
			<description><![CDATA[<div class="quotebox"><cite>com3D wrote:</cite><blockquote><p>If you don&#039;t put it in the if statement, the rayHit will be performed at every sceneUpdate (60 times per second!).<br />If you put it inside, it will be performed only when you click.</p><p>It depends on your needs: do you need to perform it all the time or at demand? The choice is yours. <img src="http://forum.maratis3d.com/img/smilies/big_smile.png" width="15" height="15" alt="big_smile" /></p></blockquote></div><p>Ahh! I see. So the point variable only exists if the mouse is clicked. Otherwise it doesn&#039;t? Gotcha!</p>]]></description>
			<author><![CDATA[dummy@example.com (Tutorial Doctor)]]></author>
			<pubDate>Sun, 13 Oct 2013 17:08:23 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=5500#p5500</guid>
		</item>
		<item>
			<title><![CDATA[Re: Rayhit]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=5487#p5487</link>
			<description><![CDATA[<p>If you don&#039;t put it in the if statement, the rayHit will be performed at every sceneUpdate (60 times per second!).<br />If you put it inside, it will be performed only when you click.</p><p>It depends on your needs: do you need to perform it all the time or at demand? The choice is yours. <img src="http://forum.maratis3d.com/img/smilies/big_smile.png" width="15" height="15" alt="big_smile" /></p>]]></description>
			<author><![CDATA[dummy@example.com (com3D)]]></author>
			<pubDate>Sun, 13 Oct 2013 05:53:57 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=5487#p5487</guid>
		</item>
		<item>
			<title><![CDATA[Re: Rayhit]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=5479#p5479</link>
			<description><![CDATA[<p>I have a question. Does:<br /></p><div class="codebox"><pre><code>point = rayHit(Apos, Bpos)</code></pre></div><p>have to be in the if statement? Could I do:</p><div class="codebox"><pre><code>Apos = getPosition(A)
Bpos = getPosition(B)
point = rayHit(Apos, Bpos)
        
-- set Bpos further (1000 is the maximum distance, set higher if needed)
Bpos[1] = Apos[1] + (Bpos[1] - Apos[1])*1000
Bpos[2] = Apos[2] + (Bpos[2] - Apos[2])*1000
Bpos[3] = Apos[3] + (Bpos[3] - Apos[3])*1000

if onKeyDown(&quot;MOUSE_BUTTON1&quot;) then 
    if point then
        print(point)    
    end
end</code></pre></div><p>And be fine?</p>]]></description>
			<author><![CDATA[dummy@example.com (Tutorial Doctor)]]></author>
			<pubDate>Sun, 13 Oct 2013 02:43:01 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=5479#p5479</guid>
		</item>
		<item>
			<title><![CDATA[Re: Rayhit]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=3324#p3324</link>
			<description><![CDATA[<p>This is great, thank you. It works perfectly!</p>]]></description>
			<author><![CDATA[dummy@example.com (Pär)]]></author>
			<pubDate>Thu, 10 Jan 2013 18:22:46 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=3324#p3324</guid>
		</item>
		<item>
			<title><![CDATA[Re: Rayhit]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=3318#p3318</link>
			<description><![CDATA[<p>You have to understand that rayHit is like a laser detector in a spy film :</p><p><span class="postimg"><img src="http://blogs.lt.vt.edu/blorg/files/2012/04/GetSmartLaser1-300x225.jpg" alt="http://blogs.lt.vt.edu/blorg/files/2012/04/GetSmartLaser1-300x225.jpg" /></span></p><p>You have to give it the first point and the last point, and if something touch it it detect the intersection.</p>]]></description>
			<author><![CDATA[dummy@example.com (anael)]]></author>
			<pubDate>Thu, 10 Jan 2013 13:40:41 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=3318#p3318</guid>
		</item>
		<item>
			<title><![CDATA[Re: Rayhit]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=3317#p3317</link>
			<description><![CDATA[<p>B is not correct, you have to give the final point of the ray.</p><p>With the new release I&#039;ll show a simpler way to do it with the matrix operation, but for now it can be done like that :</p><p><span class="postimg"><img src="http://www.maratis3d.org/wp-content/uploads/2013/01/rayHit.jpg" alt="http://www.maratis3d.org/wp-content/uploads/2013/01/rayHit.jpg" /></span></p><p>create 2 boxes A and B, don&#039;t link it to any objects (because getPosition return the local position if parented)<br />instead use the &quot;Follow&quot; behavior in &quot;local&quot; mode and set the offset to have A and B like the image (A for the tip and B to give the ray direction).</p><p>then in script :</p><div class="codebox"><pre><code>Apos = getPosition(A)
Bpos = getPosition(B)
        
-- set Bpos further (1000 is the maximum distance, set higher if needed)
Bpos[1] = Apos[1] + (Bpos[1] - Apos[1])*1000
Bpos[2] = Apos[2] + (Bpos[2] - Apos[2])*1000
Bpos[3] = Apos[3] + (Bpos[3] - Apos[3])*1000

if onKeyDown(&quot;MOUSE_BUTTON1&quot;) then 
    point = rayHit(Apos, Bpos)
    if point then
        print(point)    
    end
end</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (anael)]]></author>
			<pubDate>Thu, 10 Jan 2013 13:36:09 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=3317#p3317</guid>
		</item>
		<item>
			<title><![CDATA[Re: Rayhit]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=3314#p3314</link>
			<description><![CDATA[<p>I guess I have written a little too much on the forums lately and asking abit too much. My game is coming along really great, and now the only thing that&#039;s needed is a combat system. I have recently started to build an AI-system which makes enemys go somewhat randomly in the world. The only thing that&#039;s needed now is that I want to know if I have used the script up above correctly or if something is needed to make it work correctly.</p>]]></description>
			<author><![CDATA[dummy@example.com (Pär)]]></author>
			<pubDate>Thu, 10 Jan 2013 11:58:01 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=3314#p3314</guid>
		</item>
		<item>
			<title><![CDATA[Re: Rayhit]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=3237#p3237</link>
			<description><![CDATA[<p>Nice, now I understand it more clearly.</p><p>guntip = getObject(&quot;guntip&quot;)</p><p>&nbsp; &nbsp; Apos = getPosition(guntip)<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; A = {Apos[1], Apos[2], Apos[3]}<br />&nbsp; &nbsp; &nbsp; &nbsp; B = {100, 0, 0}<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; if onKeyDown(&quot;MOUSE_BUTTON1&quot;) then <br />&nbsp; &nbsp; &nbsp; &nbsp; point = rayHit(A, B)<br />&nbsp; &nbsp; &nbsp; &nbsp; if point then<br />&nbsp; &nbsp; &nbsp; &nbsp; print(point)&nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; end<br />&nbsp; &nbsp; end</p><p>This is what I came up with, is it used correctly?</p>]]></description>
			<author><![CDATA[dummy@example.com (Pär)]]></author>
			<pubDate>Sun, 06 Jan 2013 15:09:13 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=3237#p3237</guid>
		</item>
		<item>
			<title><![CDATA[Re: Rayhit]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=3236#p3236</link>
			<description><![CDATA[<p>It&#039;s like a 3d line, it starts from the start position and goes till end position.<br />In this exemple it goes from xyz(0, 0, 0) to xyz(100, 0, 0).</p><p>If you want to use it to detect a weapon shot, you set start as the tip of the gun and end as the maximum point the bullet can go.<br />The return point will be what you touched.</p><p>I think I&#039;ll make a real example soon.</p>]]></description>
			<author><![CDATA[dummy@example.com (anael)]]></author>
			<pubDate>Sun, 06 Jan 2013 14:16:04 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=3236#p3236</guid>
		</item>
		<item>
			<title><![CDATA[Rayhit]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=3235#p3235</link>
			<description><![CDATA[<p>Hello! Could someone please explain to me how to use Rayhit?</p><p>&nbsp; &nbsp;function onSceneUpdate()<br />&nbsp; &nbsp; &nbsp; &nbsp;start = {0, 0, 0}<br />&nbsp; &nbsp; &nbsp; &nbsp;end = {100, 0, 0}<br />&nbsp; &nbsp; &nbsp; &nbsp;point = rayHit(start, end, object)<br />&nbsp; &nbsp; &nbsp; &nbsp;if point then<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;print(point)<br />&nbsp; &nbsp; &nbsp; &nbsp;end<br />&nbsp; &nbsp;end</p><p>I understand that it goes from the start to the end and if it intersects with an object it prints out &quot;point&quot; in the console. What I don&#039;t understand is from where the ray starts from.</p>]]></description>
			<author><![CDATA[dummy@example.com (Pär)]]></author>
			<pubDate>Sun, 06 Jan 2013 13:52:26 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=3235#p3235</guid>
		</item>
	</channel>
</rss>
