<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Maratis forum - How to make buttons in Maratis]]></title>
	<link rel="self" href="http://forum.maratis3d.com/extern.php?action=feed&amp;tid=1047&amp;type=atom"/>
	<updated>2014-08-04T10:22:43Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.maratis3d.com/viewtopic.php?id=1047</id>
		<entry>
			<title type="html"><![CDATA[Re: How to make buttons in Maratis]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7116#p7116"/>
			<content type="html"><![CDATA[<p>Nice to hear <img src="http://forum.maratis3d.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></content>
			<author>
				<name><![CDATA[Sponk]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=1316</uri>
			</author>
			<updated>2014-08-04T10:22:43Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7116#p7116</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to make buttons in Maratis]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7115#p7115"/>
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Xone]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=289</uri>
			</author>
			<updated>2014-08-04T10:15:56Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7115#p7115</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to make buttons in Maratis]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7112#p7112"/>
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Sponk]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=1316</uri>
			</author>
			<updated>2014-08-04T09:31:11Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7112#p7112</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[How to make buttons in Maratis]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7111#p7111"/>
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Xone]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=289</uri>
			</author>
			<updated>2014-08-04T08:41:36Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7111#p7111</id>
		</entry>
</feed>
