<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Maratis forum - Setting up a Trigger??]]></title>
	<link rel="self" href="http://forum.maratis3d.com/extern.php?action=feed&amp;tid=1050&amp;type=atom"/>
	<updated>2014-08-07T05:36:18Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.maratis3d.com/viewtopic.php?id=1050</id>
		<entry>
			<title type="html"><![CDATA[Re: Setting up a Trigger??]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7147#p7147"/>
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[MaratisFan]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2840</uri>
			</author>
			<updated>2014-08-07T05:36:18Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7147#p7147</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Setting up a Trigger??]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7145#p7145"/>
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[ant0n]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=1562</uri>
			</author>
			<updated>2014-08-07T04:39:32Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7145#p7145</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Setting up a Trigger??]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7144#p7144"/>
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[ant0n]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=1562</uri>
			</author>
			<updated>2014-08-07T03:40:58Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7144#p7144</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Setting up a Trigger??]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7143#p7143"/>
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[MaratisFan]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2840</uri>
			</author>
			<updated>2014-08-07T00:50:30Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7143#p7143</id>
		</entry>
</feed>
