<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Maratis forum - How to make buttons in Maratis]]></title>
		<link>http://forum.maratis3d.com/viewtopic.php?id=1047</link>
		<description><![CDATA[The most recent posts in How to make buttons in Maratis.]]></description>
		<lastBuildDate>Mon, 04 Aug 2014 10:22:43 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: How to make buttons in Maratis]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=7116#p7116</link>
			<description><![CDATA[<p>Nice to hear <img src="http://forum.maratis3d.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[dummy@example.com (Sponk)]]></author>
			<pubDate>Mon, 04 Aug 2014 10:22:43 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=7116#p7116</guid>
		</item>
		<item>
			<title><![CDATA[Re: How to make buttons in Maratis]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=7115#p7115</link>
			<description><![CDATA[<p>Ah, yes, it&#039;s working!<br />Many, many thanks, Sponk! That helps a lot.<br />It&#039;s solved now. Thank you <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 (Xone)]]></author>
			<pubDate>Mon, 04 Aug 2014 10:15:56 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=7115#p7115</guid>
		</item>
		<item>
			<title><![CDATA[Re: How to make buttons in Maratis]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=7112#p7112</link>
			<description><![CDATA[<p>Hey Xone!</p><p>You need to move<br /></p><div class="codebox"><pre><code>point = getUnProjectedPoint(Camera, vec3(x, y, z))</code></pre></div><p>into your &quot;onSceneUpdate&quot; function so it updates every frame with the new cursor position.<br />Then you still have to check which button you have clicked on:</p><div class="codebox"><pre><code>point, object = rayHit(V1, V2)
if point then
    if object == Rotate then
        -- Do rotation
    elseif object == moveLeft then
        -- Move left
    elseif object == moveRight then
        -- Move right
    end
end</code></pre></div><p>This should do it.<br />If you have further question then just ask them. You don&#039;t need to be afraid because you think you are a &quot;noob&quot; <img src="http://forum.maratis3d.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>Hope this helps <img src="http://forum.maratis3d.com/img/smilies/big_smile.png" width="15" height="15" alt="big_smile" /><br />Sponk</p>]]></description>
			<author><![CDATA[dummy@example.com (Sponk)]]></author>
			<pubDate>Mon, 04 Aug 2014 09:31:11 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=7112#p7112</guid>
		</item>
		<item>
			<title><![CDATA[How to make buttons in Maratis]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=7111#p7111</link>
			<description><![CDATA[<p>Hi, everyone</p><p>I know that there are some discussions about how to make buttons in Maratis. Unfortunately, after doing some search and test, I still can&#039;t create buttons using <a href="http://wiki.maratis3d.org/index.php?title=RayHit">rayHit</a> (sorry for my noobiness <img src="http://forum.maratis3d.com/img/smilies/hmm.png" width="15" height="15" alt="hmm" />). So I tried to follow this tutorial about <a href="http://wiki.maratis3d.org/index.php?title=GetUnProjectedPoint">getUnProjectedPoint</a> but I got stuck again. <br />In my scene, I have three buttons: <strong>moveLeft, rotate,</strong> and <strong>moveRight</strong>. I want to use those buttons to move and rotate a <strong>cube</strong>.</p><p>Following the tutorial, I can make the rotation button to rotate the cube. However, when I moved the mouse cursor over the other buttons (moveLeft and moveRight), the cube also rotating. Can someone give me a hint of how to fix my script?</p><p>Here is the project file to download. <a href="https://www.dropbox.com/s/wzh0ioat20q8vgy/MouseOver_test.zip">https://www.dropbox.com/s/wzh0ioat20q8v &#133; r_test.zip</a><br />And here is the script based on the documentation:<br /></p><div class="codebox"><pre><code>moveRight = getObject(&quot;moveRight&quot;)
moveLeft = getObject(&quot;moveLeft&quot;)
Rotate = getObject(&quot;Rotate&quot;)
Cube = getObject(&quot;Cube&quot;)
Camera = getObject(&quot;Camera&quot;)

point = getUnProjectedPoint(Camera, vec3(x, y, z))

function onSceneUpdate()
  mx = getAxis(&quot;MOUSE_X&quot;)
  my = getAxis(&quot;MOUSE_Y&quot;)    
    
  V1 = getUnProjectedPoint(Camera, vec3(mx, my, 0))
  V2 = getUnProjectedPoint(Camera, vec3(mx, my, 1))
    
  point, Rotate = rayHit(V1, V2)

  if point then
    rotate(Cube, {0, 0, 1}, 4)
  end 

--[[
  if point then
    translate(Cube, {1, 0, 0}, 2)
  end 
  ]]--
  
end</code></pre></div><p>Thanks for any help.</p>]]></description>
			<author><![CDATA[dummy@example.com (Xone)]]></author>
			<pubDate>Mon, 04 Aug 2014 08:41:36 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=7111#p7111</guid>
		</item>
	</channel>
</rss>
