<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sunil&#039;s Blog &#187; MD2</title>
	<atom:link href="http://www.suniljohn.com/blog/tag/md2/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.suniljohn.com/blog</link>
	<description></description>
	<lastBuildDate>Tue, 14 Jun 2011 04:55:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Starscream, Boba Fett and Jabba the Hut&#8230;er&#8230;Jasmine the Cat&#8230;FlarToolkit AND 3D Animated Models with Keyboard Control</title>
		<link>http://www.suniljohn.com/blog/starscream-boba-fett-and-jabba-the-huterjasmine-the-catflartoolkit-and-md2-keyboard-control/</link>
		<comments>http://www.suniljohn.com/blog/starscream-boba-fett-and-jabba-the-huterjasmine-the-catflartoolkit-and-md2-keyboard-control/#comments</comments>
		<pubDate>Wed, 06 May 2009 02:03:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[FlarToolkit]]></category>
		<category><![CDATA[Papervision3D]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[Animated Collada]]></category>
		<category><![CDATA[Animated Models]]></category>
		<category><![CDATA[Augmented Reality]]></category>
		<category><![CDATA[FLARManager]]></category>
		<category><![CDATA[FLARMultiMarkerDetector]]></category>
		<category><![CDATA[MD2]]></category>

		<guid isPermaLink="false">http://www.suniljohn.com/blog/?p=156</guid>
		<description><![CDATA[Here&#8217;s a link to the live demo to try yourself: Boba Demo Direct your iphone here (don&#8217;t waste paper, if you can help it!!): Boba &#8211; http://www.suniljohn.com/labs/boba/markers/boba.jpg Starscream &#8211; http://www.suniljohn.com/labs/boba/markers/starscream.jpg Print the markers here: Boba &#8211; http://www.suniljohn.com/labs/boba/markers/boba.pdf Starscream &#8211; http://www.suniljohn.com/labs/boba/markers/starscream.pdf There are keyboard controls for both models. ASDW to move Starscream and directional arrows to [...]]]></description>
			<content:encoded><![CDATA[<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="675" height="509" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=4503519&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="675" height="509" src="http://vimeo.com/moogaloop.swf?clip_id=4503519&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>Here&#8217;s a link to the live demo to try yourself:</p>
<p><a rel="shadowbox;height=698;width=640" href="http://www.suniljohn.com/labs/boba/boba.swf">Boba Demo</a></p>
<p>Direct your iphone here (don&#8217;t waste paper, if you can help it!!):</p>
<p>Boba &#8211; <a href="http://www.suniljohn.com/labs/boba/markers/boba.jpg" rel="shadowbox[sbpost-156];player=img;" target="_blank">http://www.suniljohn.com/labs/boba/markers/boba.jpg</a></p>
<p>Starscream &#8211; <a href="http://www.suniljohn.com/labs/boba/markers/starscream.jpg" rel="shadowbox[sbpost-156];player=img;" target="_blank">http://www.suniljohn.com/labs/boba/markers/starscream.jpg</a></p>
<p>Print the markers here:</p>
<p>Boba &#8211; <a href="http://www.suniljohn.com/labs/boba/markers/boba.pdf" target="_blank">http://www.suniljohn.com/labs/boba/markers/boba.pdf</a></p>
<p>Starscream &#8211; <a href="http://www.suniljohn.com/labs/boba/markers/starscream.pdf" target="_blank">http://www.suniljohn.com/labs/boba/markers/starscream.pdf</a></p>
<p>There are keyboard controls for both models. ASDW to move Starscream and directional arrows to move Boba Fett. Each character also has jump, taunt and attack controls. The UI controls are still pretty rough, and not quite as polished as online games available over broadband connections from <a href="http://www.o2.co.uk/">o2</a> or similar providers. There are about 14 other animations I haven’t had time to program. </p>
<p>I re-factored the earlier multimarker flar prototype to use the <a href="http://words.transmote.com/wp/flarmanager/" target="_blank">FLARManager 0.3</a> from Eric Socolofsky at <a href="http://www.transmote.com" target="_blank">transmote.com</a>. I was able to trace out the string names of the individual 3D channels of the MD2 models I&#8217;ve been using. I can now play the individual animations I want to play instead of looping through them all.</p>
<p>This snippet might help those that are trying to figure out the string names of the 3d channels of their MD2 Quake 2 models:</p>
<div class="geshi no actionscript">
<div class="head">//_channels = new Array();</div>
<ol>
<li class="li1">
<div class="de1"><span class="co1">// &nbsp; _channels = animatedBoba.getAnimationChannels();</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// &nbsp; trace(&quot;channel count&quot;, _channels.length);</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// &nbsp; for each(var channel:AbstractChannel3D in _channels) {</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// &nbsp; &nbsp;_numFrames = Math.max(_numFrames, channel.keyFrames.length);</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// &nbsp; &nbsp;channel.updateToFrame(_currentFrame);</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// &nbsp; &nbsp;trace(&quot;channel.name&quot;, channel.name);</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// &nbsp; }</span></div>
</li>
</ol>
</div>
<p>I also implemented <a href="http://saqoosha.net/en/2009/01/08/1676/" target="_blank">Saqoosha&#8217;s hole effect</a> using Papervision3d, in the form of trap doors, with some slight modification to what cube faces are visible. I think this has to do flipped coordinate space, when comparing a standard PV3d scene and to the flarnode. Here&#8217;s the mod:</p>
<p>Instead of :</p>
<div class="geshi no actionscript">
<div class="head">var hole:Cube = this.scene.addChild(new Cube(new MaterialsList({all: cmats, bottom: cmatb}), 300, 300, 300, 1, 1, 1, Cube.ALL, Cube.TOP)) as Cube;</div>
<ol>
<li class="li1">
<div class="de1"><span class="kw3">this</span>._green = <span class="kw3">this</span>.<span class="me1">scene</span>.<span class="me1">addChild</span><span class="br0">&#40;</span><span class="kw2">new</span> Cube<span class="br0">&#40;</span><span class="kw2">new</span> MaterialsList<span class="br0">&#40;</span><span class="br0">&#123;</span>all: <span class="kw2">new</span> ColorMaterial<span class="br0">&#40;</span>0x00ff00<span class="br0">&#41;</span><span class="br0">&#125;</span><span class="br0">&#41;</span>, <span class="nu0">300</span>, <span class="nu0">300</span>, <span class="nu0">300</span>, <span class="nu0">1</span>, <span class="nu0">1</span>, <span class="nu0">1</span>, <span class="nu0">0</span>, Cube.<span class="me1">TOP</span><span class="br0">&#41;</span><span class="br0">&#41;</span> as Cube;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">Changed to:</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> __hole : Cube = <span class="kw2">new</span> Cube<span class="br0">&#40;</span><span class="kw2">new</span> MaterialsList<span class="br0">&#40;</span><span class="br0">&#123;</span>all: __cubeSideTexture, bottom: __cubeBottomTexture<span class="br0">&#125;</span><span class="br0">&#41;</span>, <span class="nu0">80</span>, <span class="nu0">80</span>, <span class="nu0">80</span>, <span class="nu0">1</span>, <span class="nu0">1</span>, <span class="nu0">1</span>, Cube.<span class="me1">ALL</span>, Cube.<span class="me1">FRONT</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> __green : Cube = <span class="kw2">new</span> Cube<span class="br0">&#40;</span><span class="kw2">new</span> MaterialsList<span class="br0">&#40;</span><span class="br0">&#123;</span>all: <span class="kw2">new</span> ColorMaterial<span class="br0">&#40;</span>0x00ff00<span class="br0">&#41;</span><span class="br0">&#125;</span><span class="br0">&#41;</span>, <span class="nu0">80</span>, <span class="nu0">80</span>, <span class="nu0">80</span>, <span class="nu0">1</span>, <span class="nu0">1</span>, <span class="nu0">1</span>, <span class="nu0">0</span>, Cube.<span class="me1">FRONT</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>I went through at least 10 different asymmetrical patterns for the Starscream flar marker. Most of the time the camera would keep losing the pattern or confusing it with the Boba Fett pattern. Bad lighting and problematic marker patterns were the biggest issues.</p>
<p>I don&#8217;t have to use keycodes very often, but when I do it&#8217;s always a pain trying to remember what uint corresponds with what key. Here&#8217;s a snippet I picked up for using as3 to generate keycodes:</p>
<p><a href="http://evolve.reintroducing.com/2008/11/21/tips-n-tricks/flash-key-codes/" target="_blank">http://evolve.reintroducing.com/2008/11/21/tips-n-tricks/flash-key-codes/</a></p>
<p>The end result isn&#8217;t quite this:</p>
<p><a href="http://www.suniljohn.com/blog/wp-content/uploads/2009/05/starwarschess.jpg" rel="shadowbox[sbpost-156];player=img;"><img class="aligncenter size-medium wp-image-169" title="starwarschess" src="http://www.suniljohn.com/blog/wp-content/uploads/2009/05/starwarschess-300x226.jpg" alt="starwarschess" width="648" height="486" /></a></p>
<p>&#8230;.but each time I revisit this prototype it&#8217;s seems to be getting closer&#8230;.</p>
<p>In the future I want to implement <a href="http://makc3d.wordpress.com/2009/05/05/flartoolkit-adaptive-filter-experiment-sources/" target="_blank">mac3d&#8217;s  adaptive filter</a>, to help eliminate problems with marker detection caused by poor lighting conditions.</p>
<p>Also what fun would spawning 3d characters  in AR be without laser canons and collision detection!?!</p>
<p><a href="http://www.suniljohn.com/blog/wp-content/uploads/2009/05/jasmine_jabba.jpg" rel="shadowbox[sbpost-156];player=img;"><img class="aligncenter size-medium wp-image-173" title="jasmine_jabba" src="http://www.suniljohn.com/blog/wp-content/uploads/2009/05/jasmine_jabba-300x136.jpg" alt="jasmine_jabba" width="712" height="320" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.suniljohn.com/blog/starscream-boba-fett-and-jabba-the-huterjasmine-the-catflartoolkit-and-md2-keyboard-control/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

