<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Maratis forum - Having a ray perpendicular to the ground]]></title>
		<link>http://forum.maratis3d.com/viewtopic.php?id=479</link>
		<description><![CDATA[The most recent posts in Having a ray perpendicular to the ground.]]></description>
		<lastBuildDate>Sat, 24 Nov 2012 11:45:12 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Having a ray perpendicular to the ground]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=2969#p2969</link>
			<description><![CDATA[<p>We need to add some ready made functions to manipulate vectors,<br />but for now you can do it in lua with something like that :</p><div class="codebox"><pre><code>function rotateX(vec, angle)

    zAngle = math.rad(angle)
    sinZ = math.sin(zAngle)
    cosZ = math.cos(zAngle)

    return {vec[0], vec[1] * cosZ - vec[2] * sinZ, vec[1] * sinZ + vec[2] * cosZ}

end

function rotateY(vec, angle)

    zAngle = math.rad(angle)
    sinZ = math.sin(zAngle)
    cosZ = math.cos(zAngle)

    return {vec[0] * cosZ + vec[2] * sinZ, vec[1], -vec[0] * sinZ + vec[2] * cosZ}

end

function rotateZ(vec, angle)

    zAngle = math.rad(angle)
    sinZ = math.sin(zAngle)
    cosZ = math.cos(zAngle)

    return {vec[0] * cosZ - vec[1] * sinZ, vec[0] * sinZ + vec[1] * cosZ, vec[2]}

end</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (anael)]]></author>
			<pubDate>Sat, 24 Nov 2012 11:45:12 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=2969#p2969</guid>
		</item>
		<item>
			<title><![CDATA[Re: Having a ray perpendicular to the ground]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=2967#p2967</link>
			<description><![CDATA[<p>Alright, the idea is good I guess, thanks for the reply. <br />But there&#039;s something I have to do about the definition of my floating. Because currently it is set to 10m above the ground (=10m on the z-axis) which obviously is not right. So I have to redefine my ray. I am aware of trigonometry, but I can&#039;t get this working. I have to get the ray rotating with the object, but I don&#039;t know why. Any idea? <img src="http://forum.maratis3d.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[dummy@example.com (ChickenRunFast)]]></author>
			<pubDate>Fri, 23 Nov 2012 20:43:09 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=2967#p2967</guid>
		</item>
		<item>
			<title><![CDATA[Re: Having a ray perpendicular to the ground]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=2966#p2966</link>
			<description><![CDATA[<p>Hi,</p><p>an idea, use an invisible small cube placed in front of the floating object.<br />Make the floating obj looking at the small cube (using the look-at behavior).<br />Send a ray from the transparent cube and make it float at the same height, and it should be parallell.</p>]]></description>
			<author><![CDATA[dummy@example.com (anael)]]></author>
			<pubDate>Fri, 23 Nov 2012 16:55:27 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=2966#p2966</guid>
		</item>
		<item>
			<title><![CDATA[Having a ray perpendicular to the ground]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=2965#p2965</link>
			<description><![CDATA[<p>Hey there!<br />So I&#039;m just messing around with this engine and I&#039;m feeling pretty comfortable with it. And lately I have played with some raycasts. There&#039;s one thing that I am really not able to do. I&#039;ve got my object. It&#039;s floating. Works. But now the point is, that I want the object to always be parallel to the ground. So I thought, I could do this by shooting a ray into the ground and check if that is perpendicular. But I can&#039;t get this working. Maybe you could help me.</p><p>In case you are wondering what I am trying to do, go drive that ramp up. Controls are W A S D, have fun! <a href="http://www.file-upload.net/download-6846386/test.zip.html">http://www.file-upload.net/download-684 &#133; t.zip.html</a></p><p>Edit: Im kinda unexperienced in coding and this helps me getting used to it a lot. I would prefer ideas of how to do it over real code snippets. Thanks in advance <img src="http://forum.maratis3d.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[dummy@example.com (ChickenRunFast)]]></author>
			<pubDate>Fri, 23 Nov 2012 15:51:34 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=2965#p2965</guid>
		</item>
	</channel>
</rss>
