<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Maratis forum - Setting up a Trigger??]]></title>
		<link>http://forum.maratis3d.com/viewtopic.php?id=1050</link>
		<description><![CDATA[The most recent posts in Setting up a Trigger??.]]></description>
		<lastBuildDate>Thu, 07 Aug 2014 05:36:18 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Setting up a Trigger??]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=7147#p7147</link>
			<description><![CDATA[<p>Wooow!!!&nbsp; antOn!!&nbsp; Thank you so much for the detailed tutorial!&nbsp; This helps heaps.&nbsp; Many kind thanks for your efforts!!!!!!!!!!!!</p>]]></description>
			<author><![CDATA[dummy@example.com (MaratisFan)]]></author>
			<pubDate>Thu, 07 Aug 2014 05:36:18 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=7147#p7147</guid>
		</item>
		<item>
			<title><![CDATA[Re: Setting up a Trigger??]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=7145#p7145</link>
			<description><![CDATA[<p>You can also interact with a single trigger.<br /></p><div class="codebox"><pre><code>function onSceneUpdate()
    if onEnterTrigger(triggers[1],player) then
         --...
    end
end</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (ant0n)]]></author>
			<pubDate>Thu, 07 Aug 2014 04:39:32 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=7145#p7145</guid>
		</item>
		<item>
			<title><![CDATA[Re: Setting up a Trigger??]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=7144#p7144</link>
			<description><![CDATA[<p>Not quite sure what you want to understand so I will write a detailed tutorial on the triggers.</p><p>1) Download the cube model. Make the following settings:<br />&nbsp; &nbsp; invisible = true<br />&nbsp; &nbsp; Physics (Box) = true<br />&nbsp; &nbsp; ghost = true<br /><a href="http://savepic.net/6005548.htm"><span class="postimg"><img src="http://savepic.net/6005548m.jpg" alt="http://savepic.net/6005548m.jpg" /></span></a></p><p>2) Create 3 copies of the cube (Ctrl + D). And rename them (trigger1, trigger2 and trigger3)<br /><a href="http://savepic.net/6009644.htm"><span class="postimg"><img src="http://savepic.net/6009644m.jpg" alt="http://savepic.net/6009644m.jpg" /></span></a></p><p>3)Scripting. Create a main script and open it.<br />- get our triggers.<br /></p><div class="codebox"><pre><code>--you can do this:
triggers = {getObject(&quot;trigger1&quot;),getObject(&quot;trigger2&quot;),getObject(&quot;trigger3&quot;)}

--But better to do it through the loop.
triggers = {}
num_triggers = 3    --the number of triggers.
for i=1,num_triggers do
    triggers[i] = getObject(&quot;trigger&quot;..i)
end
--it&#039;s the same thing, if done manually:
--triggers[1] = getObject(&quot;trigger1&quot;)
--triggers[2] = getObject(&quot;trigger2&quot;)
--triggers[3] = getObject(&quot;trigger3&quot;)</code></pre></div><p>Now let&#039;s write a function entry trigger.<br /></p><div class="codebox"><pre><code>function onEnterTrigger(trigger,entity)
    if isCollisionBetween(trigger, entity) then --if collision
        return true
    end
end</code></pre></div><p>Now, to verify create three cubes. Applied physics them and place them on the triggers. And create the camera.<br /><a href="http://savepic.net/5984044.htm"><span class="postimg"><img src="http://savepic.net/5984044m.jpg" alt="http://savepic.net/5984044m.jpg" /></span></a></p><p>get these cubes.<br /></p><div class="codebox"><pre><code>cubes = {}
num_cubes = 3
for i=1,num_cubes do
    cubes[i] = getObject(&quot;cube&quot;..i)
end</code></pre></div><p>Let&#039;s do that in contact with triggers, cubes disappeared.</p><div class="codebox"><pre><code>function onSceneUpdate()
    for i=1,#triggers do
        if onEnterTrigger(triggers[i],cubes[i]) then
            deactivate(cubes[i])
        end
    end
end</code></pre></div><p>Result:<br /><a href="http://savepic.net/5987116.htm"><span class="postimg"><img src="http://savepic.net/5987116m.jpg" alt="http://savepic.net/5987116m.jpg" /></span></a><br /><a href="http://savepic.net/5980972.htm"><span class="postimg"><img src="http://savepic.net/5980972m.jpg" alt="http://savepic.net/5980972m.jpg" /></span></a></p><p><a href="https://yadi.sk/d/TnybrdkyZCjzi">download project.</a></p>]]></description>
			<author><![CDATA[dummy@example.com (ant0n)]]></author>
			<pubDate>Thu, 07 Aug 2014 03:40:58 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=7144#p7144</guid>
		</item>
		<item>
			<title><![CDATA[Setting up a Trigger??]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=7143#p7143</link>
			<description><![CDATA[<p>This email request follow a Sound trigger set up by antOn who helped me organse sounds as one passed a different space.</p><p>I have some question about setting up a Trigger.&nbsp; I understand how to create a box and then make it invisible, but I cannot understand how you name it Trigger 1, Trigger 2 etc.&nbsp; so that it appears in the Objects List?</p>]]></description>
			<author><![CDATA[dummy@example.com (MaratisFan)]]></author>
			<pubDate>Thu, 07 Aug 2014 00:50:30 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=7143#p7143</guid>
		</item>
	</channel>
</rss>
