<?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/"
	>

<channel>
	<title>BleepnGames, Unity iPhone Develpment Blog</title>
	<atom:link href="http://www.bleepng.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bleepng.com/blog</link>
	<description>Adventures in developing with Unity iPhone</description>
	<pubDate>Wed, 23 Sep 2009 04:25:20 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Moving An iTunes Library from WinXP to Mac</title>
		<link>http://www.bleepng.com/blog/2009/06/moving-an-itunes-library-from-winxp-to-mac/</link>
		<comments>http://www.bleepng.com/blog/2009/06/moving-an-itunes-library-from-winxp-to-mac/#comments</comments>
		<pubDate>Sat, 13 Jun 2009 20:45:53 +0000</pubDate>
		<dc:creator>meanstreak</dc:creator>
		
		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[iPhone]]></category>

		<category><![CDATA[iTunes]]></category>

		<guid isPermaLink="false">http://www.bleepng.com/blog/?p=84</guid>
		<description><![CDATA[Now that I&#8217;m connecting my iPhone to the Mac all the time for use during game development, I figured it was time to move my iTunes library over to the Mac so I don&#8217;t have to do my music, video, app synching on a different machine than my dev platform.
I checked out a bunch of [...]]]></description>
			<content:encoded><![CDATA[<p>Now that I&#8217;m connecting my iPhone to the Mac all the time for use during game development, I figured it was time to move my iTunes library over to the Mac so I don&#8217;t have to do my music, video, app synching on a different machine than my dev platform.</p>
<p>I checked out a bunch of blog posts that explain how to make the transition but many were out of date with the current iTunes software and most of them were concerned with keeping playcounts and stuff like that intact.  I only care about keeping: music tracks, iPhone apps, podcasts, and my playlists.  I thought for sure at the very least I&#8217;d have to remake my playlists, but turns out that iTunes had me covered!</p>
<p>Here&#8217;s what I did:</p>
<p><strong>1. Update the iTunes software</strong> on both the Win and Mac to make sure they&#8217;re both running the same version.  This may not be necessary, but better safe than sorry.</p>
<p><strong>2. Update all of your apps in iTunes</strong>, get the latest podcasts, and basically just make sure everything on the Windows machine is current.</p>
<p><strong>3. Synch the iPhone one last time</strong> on the Windows machine to make sure all apps and everything is up to date on both the computer and iPhone.  This may not be necessary since when you synch on the Mac it&#8217;ll nuke everything on the iPhone anyway, but I just wanted to be safe.</p>
<p><strong>4.  Copy the contents</strong> of your <em>My Music</em> folder onto a portable hard drive.</p>
<p>Some of the blogs I read suggested consolidating the library so everything is in the <em>iTunes</em> folder, but I like to organize my files into my own folders so I didn&#8217;t consolidate.</p>
<p><strong>5. Connect the portable hard drive</strong> to your Mac and launch iTunes.</p>
<p><strong>6. Drag and drop</strong> all the folders from the music folder on the hard drive directly on to the iTunes window.  I suggest only dragging a few folders at a time to keep from bogging down your computer and/or freaking out iTunes.</p>
<p>iTunes will automatically copy all of the files from the portable drive into your <em><strong>music/iTunes/iTunes Music</strong></em> folder on your Mac&#8217;s hard drive.  It even kept all of my folders organized just like I had them on my PC.</p>
<p>Note when copying the <em>iTunes</em> folder from the portable hard drive, I went into that folder and then drag and dropped the subdirectories into iTunes rather than dragging the root folder.  I don&#8217;t know if this makes a difference, but it felt like the right way to go.</p>
<p>When you&#8217;re all done you should see everything that was on your Windows machine in iTunes including your Music, Videos, Applications, and Podcasts.  The one thing you won&#8217;t see yet are your playlists. I tried dragging the <strong><em>iTunes Music Library.xml </em></strong>onto the iTunes window but that didn&#8217;t import it.</p>
<p><strong>7.  Import your Playlis</strong>t by going to <strong><em>File &#8211;&gt; Library &#8211;&gt; Import Playlist&#8230;</em></strong> and then browse to the <em><strong>iTunes Music Library.xml </strong></em>file on your portable hard drive (eg. <em><strong>/volumes/WD Passport/Music/iTunes/iTunes Music Library.xm</strong></em><em><strong>l</strong></em>.</p>
<p>iTunes will automatically fix the paths and all of your playlists should appear populated just like they were on your Windows machine.  Awesome!</p>
<p><strong>8.  Now it&#8217;s time to synch your iPhone</strong> to the iTunes library on your Mac (bye bye Windows!).  Start iTunes (if it&#8217;s not running already) and plug in your iPhone.  After a few seconds the iPhone should show up in the sidebar just like normal.  Now if you click &#8220;Synch&#8221; on the Summary tab, nothing will happen (didn&#8217;t for me at least).</p>
<p>You need to go thru the tabs and check the stuff you want to synch: Ringtones, Music, Podcasts, Video, Applications.  I left Photos unchecked since I do my photo synching with iPhoto.</p>
<p>Once you&#8217;ve checked all the stuff you want to Synch, hit the Apply (or Synch) button.  Next you&#8217;ll get a warning telling you that your iPhone can only be synched with 1 computer and that everything on the phone will be deleted and replaced with this iTunes library.  Since you copied everything from your Windows machine onto the Mac, everything should be exactly the same after the synch &#8212; the only difference being you now synch to your Mac instead of your PC.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bleepng.com/blog/2009/06/moving-an-itunes-library-from-winxp-to-mac/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Purchased Unity Indie with iPhone Basic</title>
		<link>http://www.bleepng.com/blog/2009/06/purchased-unity-indie-with-iphone-basic/</link>
		<comments>http://www.bleepng.com/blog/2009/06/purchased-unity-indie-with-iphone-basic/#comments</comments>
		<pubDate>Sat, 13 Jun 2009 19:54:44 +0000</pubDate>
		<dc:creator>meanstreak</dc:creator>
		
		<category><![CDATA[Unity]]></category>

		<guid isPermaLink="false">http://www.bleepng.com/blog/?p=81</guid>
		<description><![CDATA[My 30 day trial ran out yesterday so I purchased the Unity Indie with iPhone Basic license today for $590.00.  Thanks to the Unity3D team for making such a great product.  Now the only thing left to do is ship a game!  heh
]]></description>
			<content:encoded><![CDATA[<p>My 30 day trial ran out yesterday so I purchased the Unity Indie with iPhone Basic license today for $590.00.  Thanks to the Unity3D team for making such a great product.  Now the only thing left to do is ship a game!  heh</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bleepng.com/blog/2009/06/purchased-unity-indie-with-iphone-basic/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Finding The Right Maya to Unity Scale</title>
		<link>http://www.bleepng.com/blog/2009/05/finding-the-right-maya-to-unity-scale/</link>
		<comments>http://www.bleepng.com/blog/2009/05/finding-the-right-maya-to-unity-scale/#comments</comments>
		<pubDate>Thu, 28 May 2009 18:44:18 +0000</pubDate>
		<dc:creator>meanstreak</dc:creator>
		
		<category><![CDATA[Maya]]></category>

		<category><![CDATA[Unity]]></category>

		<guid isPermaLink="false">http://www.bleepng.com/blog/?p=74</guid>
		<description><![CDATA[I&#8217;ve been playing around with determining the right Maya Scale to Unity Scale and I discovered some things.
• A 10&#215;10 Centimeter plane exported from Maya is exactly the same size as a Unity Plane with a default scale of 1,1,1.
• A 10&#215;10 Meter plane exported from Maya is, as you&#8217;d expect, 100 times bigger than [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing around with determining the right Maya Scale to Unity Scale and I discovered some things.</p>
<p>• A 10&#215;10 <strong>Centimeter</strong> plane exported from Maya is exactly the same size as a Unity Plane with a default scale of 1,1,1.</p>
<p>• A 10&#215;10 <strong>Meter</strong> plane exported from Maya is, as you&#8217;d expect, 100 times bigger than the default Unity Plane scale.  So if you scale up the Unity Plane 100,1,100 it would be the same size as a 10m square Maya Plane.</p>
<p>• A 10&#215;10 <strong>Millimeter</strong> plane exported from Maya is 10 times smaller than the default Unity Plane scale of 1,1,1.</p>
<p>Looking at the grid in Unity iPhone, there are major units and minor units.  When converting scale from Maya to Unity, you can think of:<br />
• Major units as 1 Meter<br />
• Minor units as 1 Centimeter.</p>
<p>Based on these findings, I no longer think that setting Maya to Millimeters (as I suggested in the <a title="Unity iPhone Touch Animation Tutorial" href="http://www.bleepng.com/blog/2009/05/unity-iphone-touch-animation-tutorial/">Unity iPhone Touch Animation Tutorial</a>) is the right choice.</p>
<p>Either Meters or Centimeters looks like the right way to go when creating objects in Maya.  Deciding which one to work with is probably up to personal preference and different projects might end up working better at different scales.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bleepng.com/blog/2009/05/finding-the-right-maya-to-unity-scale/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Moving An Object With Touch</title>
		<link>http://www.bleepng.com/blog/2009/05/moving-an-object-with-touch/</link>
		<comments>http://www.bleepng.com/blog/2009/05/moving-an-object-with-touch/#comments</comments>
		<pubDate>Tue, 26 May 2009 06:49:39 +0000</pubDate>
		<dc:creator>meanstreak</dc:creator>
		
		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[Unity]]></category>

		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.bleepng.com/blog/?p=52</guid>
		<description><![CDATA[I thought there would be all kinds of examples of how to move an object around in the scene using Touch, but I couldn&#8217;t find anything that was simple and straightforward for someone just starting out with Java (like me!).
After digging around in a bunch of different scripts and reading thru a ton a posts [...]]]></description>
			<content:encoded><![CDATA[<p>I thought there would be all kinds of examples of how to move an object around in the scene using Touch, but I couldn&#8217;t find anything that was simple and straightforward for someone just starting out with Java (like me!).</p>
<p>After digging around in a bunch of different scripts and reading thru a ton a posts on the Unity Forum, I found <a title="iPhoneTouch.position ... an example, I beg you!" href="http://forum.unity3d.com/viewtopic.php?t=15264&amp;highlight=move+object+finger">this</a> post by <a href="http://col000r.blogspot.com/">col000r</a> which had a nice, simple example.  I simplified it a little bit so it would work with just 1 attached object.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>touch in iPhoneInput.<span style="color: #006633;">touches</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>touch.<span style="color: #006633;">phase</span> <span style="color: #339933;">==</span> iPhoneTouchPhase.<span style="color: #006633;">Moved</span> <span style="color: #339933;">||</span> touch.<span style="color: #006633;">phase</span> <span style="color: #339933;">==</span> iPhoneTouchPhase.<span style="color: #006633;">Began</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          transform.<span style="color: #006633;">position</span> <span style="color: #339933;">=</span> Camera.<span style="color: #006633;">main</span>.<span style="color: #006633;">ScreenToWorldPoint</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Vector3 <span style="color: #009900;">&#40;</span>touch.<span style="color: #006633;">position</span>.<span style="color: #006633;">x</span>, touch.<span style="color: #006633;">position</span>.<span style="color: #006633;">y</span>, 10<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>That script gets a good bit of the job done, but the object will jump to the position of you finger no matter where you touch the screen.  I wanted the object to only move if you touch it directly.  So I added in the raycast code from my previous <a title="Unity iPhone Touch Animation Tutorial" href="http://www.bleepng.com/blog/2009/05/unity-iphone-touch-animation-tutorial/">Unity iPhone Touch Animation Tutorial</a> (which I found in the iPhone-Match example project).</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">function Update <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     var hit <span style="color: #339933;">:</span> RaycastHit<span style="color: #339933;">;</span>
     var ray <span style="color: #339933;">=</span> Camera.<span style="color: #006633;">main</span>.<span style="color: #006633;">ScreenPointToRay</span> <span style="color: #009900;">&#40;</span>Input.<span style="color: #006633;">mousePosition</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>Physics.<span style="color: #006633;">Raycast</span> <span style="color: #009900;">&#40;</span>ray, hit, <span style="color: #cc66cc;">100</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #666666; font-style: italic;">//do something here</span>
     <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>TouchMove Mini-Tutorial:</strong></p>
<p>You can download the <a title="Tut2-TouchMove.zip" href="http://www.bleepng.com/blog/tutorials/tut2-touchmove/Tut2-TouchMove.zip"><strong>Tut2-TouchMove.zip</strong></a> <strong></strong>project before you get started to see the completed tutorial or you can follow along with the steps below. This one is pretty simple, so following the steps won&#8217;t take long.</p>
<p><strong>1. Create a cube:</strong> Go to <em>Game Object &#8211;&gt; Create Other &#8211;&gt; Cube</em></p>
<p><strong>2. Add a Box Collider to the Cube:</strong> Go to <em>Add Component &#8211;&gt; Physics &#8211;&gt; Box Collider</em> (if your cube doesn&#8217;t already have one)</p>
<p><strong>3. Create a new script: </strong> Go to <em>Assets &#8211;&gt; Create &#8211;&gt; Javascript</em>.  This will create a new script in your Project panel named NewBehaviourScript.  Double-click the script in your Project panel to open it in Unitron.</p>
<p>Copy the following code, paste it into the file, save, and then switch back in Unity.  Drag-and-drop the script from the Project view onto the cube in either the Hierarchy or Scene panel.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">&nbsp;
function Update <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     var hit <span style="color: #339933;">:</span> RaycastHit<span style="color: #339933;">;</span>
     var ray <span style="color: #339933;">=</span> Camera.<span style="color: #006633;">main</span>.<span style="color: #006633;">ScreenPointToRay</span> <span style="color: #009900;">&#40;</span>Input.<span style="color: #006633;">mousePosition</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>touch in iPhoneInput.<span style="color: #006633;">touches</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>Physics.<span style="color: #006633;">Raycast</span> <span style="color: #009900;">&#40;</span>ray, hit, 100<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	     <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>touch.<span style="color: #006633;">phase</span> <span style="color: #339933;">==</span> iPhoneTouchPhase.<span style="color: #006633;">Moved</span> <span style="color: #339933;">||</span> touch.<span style="color: #006633;">phase</span> <span style="color: #339933;">==</span> iPhoneTouchPhase.<span style="color: #006633;">Began</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	          transform.<span style="color: #006633;">position</span> <span style="color: #339933;">=</span> Camera.<span style="color: #006633;">main</span>.<span style="color: #006633;">ScreenToWorldPoint</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Vector3 <span style="color: #009900;">&#40;</span>touch.<span style="color: #006633;">position</span>.<span style="color: #006633;">x</span>, touch.<span style="color: #006633;">position</span>.<span style="color: #006633;">y</span>, 10<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	     <span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
     <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>4. Be sure to set your iPhone Bundle Identifier</strong>: Go to <em>Edit &#8211;&gt; Project Settings &#8211;&gt; Player</em> and then give it a domain and name.  See Step 16 in the <a title="Unity iPhone Touch Animation Tutorial" href="http://www.bleepng.com/blog/2009/05/unity-iphone-touch-animation-tutorial/">Unity iPhone Touch Animation Tutorail</a> if you need help with this step.</p>
<p><strong>5.  Build and Run: </strong>That should do it.</p>
<p>Note that if you have multiple objects with Colliders on them, your cube will move when you click on any of them (bug!).</p>
<p>Feel free to post in the comments improvements to the above script and/or if you have suggestions for how to handle any of the following&#8230;</p>
<p><strong>Planned improvements:</strong><br />
&#8211; Object should only move if you touch it, not other Mesh Colliders.<br />
&#8211; Object should collide with other objects while being moved<br />
&#8211; Object should continue to move after you lift your finger, slow over time &#8212; like a hockey puck.<br />
&#8211; Object should bounce off other objects<br />
&#8211; Move multiple objects independently</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bleepng.com/blog/2009/05/moving-an-object-with-touch/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Unity iPhone Touch Animation Tutorial</title>
		<link>http://www.bleepng.com/blog/2009/05/unity-iphone-touch-animation-tutorial/</link>
		<comments>http://www.bleepng.com/blog/2009/05/unity-iphone-touch-animation-tutorial/#comments</comments>
		<pubDate>Thu, 21 May 2009 21:53:57 +0000</pubDate>
		<dc:creator>meanstreak</dc:creator>
		
		<category><![CDATA[Maya]]></category>

		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[Unity]]></category>

		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.bleepng.com/blog/?p=21</guid>
		<description><![CDATA[I started working with Unity iPhone a few days ago and I&#8217;ve been digging around in the example game project files and reading thru forum posts looking for clues on how to make stuff work.   I&#8217;ve found a few good/basic tutorials but I was looking for something a little different so I figured I&#8217;d [...]]]></description>
			<content:encoded><![CDATA[<p>I started working with Unity iPhone a few days ago and I&#8217;ve been digging around in the example game project files and reading thru forum posts looking for clues on how to make stuff work.   I&#8217;ve found a few good/basic tutorials but I was looking for something a little different so I figured I&#8217;d just dive in.</p>
<p>For my first &#8220;hello world&#8221; app, I came up with a basic <strong>goal: <em>touch the screen to play an animation on an object.</em></strong></p>
<p>After an hour or two digging around in forums, scripting manual, and the iPhone-Match example game, I managed to come up with a simple little app that actually works on my iPhone!</p>
<p>I was so excited to see this thing working and it was so much fun to put together that I figured why not put together a tutorial!?  So I did!</p>
<p>This tutorial covers quite a few basics including:<br />
&#8211; playing animations on a 3d object when you touch and un-touch the screen.<br />
&#8211; creating and animating a simple object in Maya<br />
&#8211; setting up the animations in Unity<br />
&#8211; setting up a basic 2D scene with default lighting and Main Camera position<br />
&#8211; adding a 2D background image</p>
<p><img class="alignnone size-full wp-image-44" title="tut1-touchanim iphone screenshot" src="http://www.bleepng.com/blog/wp-content/uploads/2009/05/tut1-touchanim_ss1.png" alt="tut1-touchanim iphone screenshot" width="400" height="211" /></p>
<p>You can download the entire <strong><a title="the completed Tut1-TouchAnim project files" href="http://www.bleepng.com/blog/tutorials/tut1-touchanim/Tut1-TouchAnim.zip">Tut1-TouchAnim.zip</a></strong> project before you get started or you can do the whole thing from scratch just by following along with the steps below.  Let&#8217;s get started!</p>
<p><strong>1. Create a new Project:</strong> Go to<strong> </strong><em>File &#8211;&gt; New Project &#8211;&gt; Set&#8230;</em> and browse to where you keep your Unity projects (mine are in <em>Documents\Unity Projects</em>), then in the Save As&#8230; field type &#8220;<em>Tut1-TouchAnim</em>&#8221; and click the Save button.</p>
<p><strong>2. Create Project folders: </strong> In the Project panel, click the <strong>Create </strong>button and then select <strong>Folder </strong>from the list.  This will add a new folder to your Project named <em>New Folder</em>.  The folder is also created on the hard drive in your <em>Tut1-TouchAnim\Assets</em> directory.</p>
<p>Click once on the folder name (New Folder) to edit it and type &#8220;Objects&#8221; (without the quotes).</p>
<p>Click anywhere in the Project panel to deselect the Objects folder then click the <strong>Create </strong>button again and select <strong>Folder </strong>from the list.  Rename this 2nd folder &#8220;<em>Scripts</em>&#8220;.</p>
<p>Click anywhere in the Project panel to deselect the Scripts folder then click the <strong>Create </strong>button again and select <strong>Folder </strong>from the list.  Rename this 2nd folder &#8220;<em>Textures</em>&#8220;.</p>
<p><strong>3. Save your Scene:</strong> Go to  <em>File &#8211;&gt; Save Scene</em> and name it &#8220;Tut1-TouchAnim&#8221;</p>
<p><strong>4. Maya Setup:</strong> In Maya go to <em>Window &#8211;&gt; Settings/Preferences &#8211;&gt; Preferences</em> and then click on <strong>Settings </strong>in the Preferences window.</p>
<p>&#8211; Set the Up axis to &#8220;Y&#8221; since Y is up in Unity.</p>
<p>&#8211; Change the Linear Working Units to &#8220;Millimeter&#8221;.  Currently I find that this is the best scale for getting a good (close enough?) 1:1 size from Maya to Unity.</p>
<p><em>Note: please feel free to comment on the above Maya settings if you&#8217;ve found a better setup.</em></p>
<p><strong>5. Create an object in Maya: </strong> I&#8217;m using Maya 2008, but the general ideas here will apply to any modeling/animation program.</p>
<p>Make a cube by going to <em>Create &#8211;&gt; Polygon Primitives &#8211;&gt; Cube</em> and then draw out a rough cube on the grid.</p>
<p>Select the cube and then in the Channel Bar under INPUTS click on <strong>polyCube1 </strong>(yours may be named slightly different).  Set the Width, Height and Depth to 20 (this assumes your working units are set to millimeters).</p>
<p>Set the <strong>Translate X:0</strong>, <strong>Y:0</strong> and <strong>Z:0</strong> so the cube is centered on the grid.</p>
<p>Set the <strong>Rotate X:45</strong>, <strong>Rotate Y:45</strong>, and <strong>Rotate Z:45</strong>.  This will make the cube kinda stand up on one corner to give the animation a little visual interest.</p>
<p><strong>6. Animate the cube: </strong> We&#8217;re going to be making 2 very simple animations where the cube will rotate &#8220;forward&#8221; 180 degrees and then rotate &#8220;backward&#8221; 180 degrees to its default position.</p>
<p>First create the forward animation:<br />
With the Timeline slider at <strong>Frame 1</strong> and your Cube selected, press the &#8220;s&#8221; key to add a frame.  Or go to <em>Animate &#8211;&gt; Set key</em> (you&#8217;ll need to be in Animation mode).</p>
<p>Drag the slider on the timeline to <strong>Frame 10</strong>, change the cube&#8217;s <strong>Rotate Y:225</strong> and press &#8220;s&#8221; to add a new keyframe at frame 10.</p>
<p>Next create the backward animation:<br />
Drag the timeline slider to <strong>Frame 20</strong>, change the cube&#8217;s <strong>Rotate Y:45</strong> and press the &#8220;s&#8221; key to add a new keyframe at frame 20.</p>
<p>That&#8217;s it for the animations.  As far as Maya is concerned, we&#8217;ve only created 1 animation, but in Unity we&#8217;ll see how this single Maya anim can be made into 2.</p>
<p><strong>7. Save the animated cube: </strong>In Maya go to <em>File &#8211;&gt; Save Scene As&#8230;</em> and browse to your <em>Tut1-TouchAnim\Assets\Objects </em>directory and save it there as <strong>cubeAnim.mb</strong>.</p>
<p><strong>8.  Setting up the animated object in Unity:</strong> Switch back to Unity and you&#8217;ll see that there&#8217;s now a file in the project&#8217;s Object folder named &#8220;cubeAnim&#8221;.</p>
<p>Select <strong>cubeAnim</strong> (top node) in the project&#8217;s Objects folder and then click on the <strong>Settings&#8230; </strong> button.  This will bring up a dialogue that allows you to adjust the objects Import settings.</p>
<p>Click the <strong>Add clip</strong> button which will add a default animation to the list below named &#8220;idle&#8221;.  Click on the word &#8220;idle&#8221; and type in <strong>forward</strong>.  Leave first frame set to 1 and change the last frame to 10.</p>
<p>Click the <strong>Add clip</strong> button again, click on the &#8220;idle&#8221; text, and type in <strong>backward</strong>.  Leave the first frame set to 11 and change the last frame to 20.</p>
<p>Leave &#8220;loop frame&#8221; unchecked for both clips.</p>
<p>Click the <strong>Import </strong>button and after a few seconds you should see in the Project panel under <strong>cubeAnim </strong>that there are now 2 animations named <strong>backward</strong> and <strong>forward</strong>. If you select <strong>cubeAnim </strong>and look in the <strong>Inspector </strong>under Animations, you&#8217;ll see that Element 0 has the &#8220;forward&#8221; animation assigned and Element 1 has the &#8220;backward&#8221; animation assigned.</p>
<p><strong>9. Adding your object to the Scene: </strong> First thing we&#8217;re going to do is add a new <strong>empty Game Object</strong> to the scene which we will Parent our <strong>cubeAnim </strong>object to.  Go to <strong>Game Object &#8211;&gt; Create Empty</strong>.  You&#8217;ll see that a <strong>GameObject</strong> has been added to the <strong>Hierarchy </strong>panel.</p>
<p>Next select the <strong>cubeAnim </strong>object in the <strong>Projects </strong>panel and drag-and-drop it onto the <strong>GameObject </strong>in the <strong>Hierarchy </strong>panel to make the cubeAnim a child of GameObject.  Your cubeAnim object should now also be visible in the Scene and in the Game panel (if you have it open).</p>
<p>Note: you could simply drag cubeAnim into the scene without parenting it to a GameObject, but you&#8217;ll find that when the cubeAnim&#8217;s animation plays, it&#8217;ll always reset its position in the Scene to Frame 1 as it was set in Maya.  With the cube parented to a GameObject, you can move the GameObject anywhere in the scene and the animation will play at that location.</p>
<p><strong>10.  Adding a script:</strong> In the <strong>Project </strong>panel, select the <strong>Scripts </strong>folder, click the <strong>Create </strong>button, and select <strong>JavaScript </strong>from the drop down list.  This will add a new script to the Scripts folder named NewBehaviorScript.  Click on the scripts text and rename it to <strong>TouchAnim</strong>.</p>
<p>Double click the <strong>TouchAnim </strong>script in the Projects panel to open it up in <strong>Unitron </strong>(or whatever script editor you have set).</p>
<p>Download my <strong><a title="TouchAnim.js" href="http://www.bleepng.com/blog/tutorials/tut1-touchanim/TouchAnim.js">TouchAnim.js</a></strong> file (right or ctrl click to save as&#8230;) and copy/paste the contents into your own script.  Save your script file and then task back to Unity.  If you click on the TouchAnim script in the Project panel, you should see the contents of the file in the <strong>Inspector</strong>.</p>
<p><strong>11. Attach the script to your object:</strong> Select the <strong>TouchAnim </strong>script in the <strong>Project </strong>panel and then drag-and-drop it onto the <strong>cubeAnim </strong>object in the <strong>Hierarchy </strong>panel.</p>
<p>To confirm that the script is attached, select the cubeAnim object in the Hierarchy panel and you should see <strong>Touch Anim (Script)</strong> component listed in the <strong>Inspector</strong>.</p>
<p><strong>12. Add a Mesh Collider to your object:</strong> Select <strong>cubeAnim </strong>in the <strong>Hierarchy </strong>panel and then go to <em>Component &#8211;&gt; Physics &#8211;&gt; Mesh Collider</em>.  This will add the Mesh Collider component to your object &#8212; you should see it in the Inspector.  Without a Mesh Collider the script won&#8217;t be able to detect a collision with your cube.</p>
<p>At this point, if you press the Play button on your Game view, you can mouse-click on/off the cube and it should animate forward and backward.</p>
<p><strong>13. Adjusting the Main Camera :</strong> Something that I don&#8217;t understand about the default Main Camera Position and Rotation, is that it&#8217;s set to look at the scene from the back instead of the front.  Which means any objects you import from Maya will look backwards in the Game view.  We&#8217;re going to set up the Main Camera so that it&#8217;s facing (what I consider to be) forward and adjust its position so that it&#8217;ll nicely frame the background image we&#8217;ll be creating in the next step.</p>
<p>Select the <strong>Main Camera</strong> in the <strong>Hierarchy </strong>panel and set <strong>Position: 0,0, 8.1</strong> and <strong>Rotation: 0, 180,0</strong>.</p>
<p><strong>14. Adding a textured background: </strong> To give the scene a little nicer presentation, add a <strong>Plane </strong>by going to <em>Game Object &#8211;&gt; Create Other &#8211;&gt; Plane</em>.  This will add a Plane at 0,0,0.</p>
<p>Select the <strong>Plane </strong>in the Scene or from the Hierarchy and set <strong>Rotation:90,0,0</strong>.  The default position (0,0,0) and Scale (1,1,1) should be just right for the Main Camera we setup in the previous step.</p>
<p>Your new Plane will have the Mesh Collider component on it by default (mine does at least).  You&#8217;ll need to remove this so that the script will only collide with the cube and not with the background.  Select the Plane, then in the Inspector click the little &#8220;gear&#8221; icon next to the Mesh Collider component and select &#8220;Remove Component&#8221; from the dropdown list.</p>
<p>Download this <strong><a title="defGrid.psd" href="http://www.bleepng.com/blog/tutorials/tut1-touchanim/defGrid.psd">default grid texture</a></strong> and put it in your <em>Tut1-TouchAnim\Assets\Textures</em> directory.</p>
<p>In Unity, select the <strong>defGrid </strong>texture from the Project&#8217;s <strong>Textures </strong>folder and drag-and-drop it onto the <strong>Plane </strong>in the <strong>Scene </strong>view.  If you adjusted the Main Camera position and the Plane rotation correctly in the previous steps, the Grid pattern should fit perfectly in the Game view.</p>
<p><strong>15. Adding a Light to the scene: </strong>To get a nice bright rendering of the scene, add a light by going to <em>Game Object &#8211;&gt; Create Other &#8211;&gt; Directional Light</em>.  This will create a new Directional Light at 0,0,0.  Move the light somewhere near the Main Camera and rotate it so it points at the cube.  My position is set to 0,0,15 and the rotation is set to 0,180,0.</p>
<p>All of the default light settings for the Directional Light should work fine, except change the <strong>Render Mode </strong>to <strong>&#8220;Force vertex&#8221;</strong>.  I&#8217;m not sure yet what that does, but that&#8217;s how the iPhone-Match game has their Directional Light set.</p>
<p><strong>16. Set the iPhone Bundle Identifier: </strong> I&#8217;m still a bit confused as to exactly how this works as I think it&#8217;s supposed to somehow match your App ID that you setup at the iPhone Developer Portal.  But I set my Bundle Identifier to * (asterisks) so I assumed that&#8217;s what I&#8217;d enter in Unity&#8230; but that doesn&#8217;t work for me.</p>
<p>In Unity, go to <em>Edit &#8211;&gt; Project Settings &#8211;&gt; Player</em> to display the player settings in the Inspector.  Next to<strong> iPhone Bundle Identifier</strong>, you should see &#8220;<strong>com.Company.ProductName</strong>&#8220;.  I set this to <strong>com.bleepng.touchanim</strong> which works for me.  You may need to play around with this on your side to get it to work properly.</p>
<p><strong>17. Play it in Unity: </strong>We&#8217;re all done.  If you press the Play button in your Game view, you should be able to click on and off of the cube to see the animation play forward and backward.  Note that the animation should only play if you click directly on the cube, not on the background plane.</p>
<p>Note, if you want the animation to play when you click anywhere on the screen, simply remove the<em> if (Physics.Raycast (ray, hit, 100))</em> lines from the script.  Or add a Mesh Collider component to your background Plane.</p>
<p><strong>18. Build &amp; Run it on your iPhone: </strong>Setting up Xcode and configuring your iPhone to run apps is beyond the scope of this tutorial, so I&#8217;ll assume you&#8217;ve done all of that already.</p>
<p>Launch Xcode and plug in your iPhone.  Be sure to unlock your phone or Xcode may give you warnings when it tries to install and launch the app on your phone.</p>
<p>In Unity, go to <em>File &#8211;&gt; Build &amp; Run</em> and then click the <strong>Build &amp; Run</strong> button on the Build Game screen.  At the Save Player window, type <strong>touchanim </strong>and click Save.</p>
<p>Once Unity finishes building the game, Xcode will compile everything, install it on your iPhone and automatically launch it (if your iPhone isn&#8217;t locked).</p>
<p><strong>Conclusion:</strong><br />
When you&#8217;re all done, your Unity project should look something like my setup in this screenshot (click the image to see full sized).</p>
<p><a href="http://www.bleepng.com/blog/tutorials/tut1-touchanim/tut1-TouchAnim_Unityss.png"><img class="size-full wp-image-31 alignnone" title="tut1-touchanim Unity screen shot" src="http://www.bleepng.com/blog/wp-content/uploads/2009/05/tut1-touchanim_unityss_sm.png" alt="tut1-touchanim Unity screen shot" width="450" height="252" /></a></p>
<p>Hopefully you had as much fun following this tutorial as I had writing it.  Feel free to leave comments on how to improve this tutorial, or if you find any bugs in it, or if you have any questions. Also please let me know if you&#8217;re aware of any other tutorials out there we should look at.</p>
<p>I should point out that I&#8217;m a Designer by trade and not a programmer, so any questions on the scripting side of this tutorial should probably directed towards the Unity Forums rather than to me. That said, I&#8217;m just as eager to understand the programming side of Unity as you are so I&#8217;ll be following along with the discussion.</p>
<p>I&#8217;ve posted a link to this tutorial from the Unity Forums, so be sure to check there for related discussion.  <strong><a title="Unity iPhone Tutorial forum post" href="http://forum.unity3d.com/viewtopic.php?t=24996">Unity iPhone Tutorial forum post</a></strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bleepng.com/blog/2009/05/unity-iphone-touch-animation-tutorial/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Digging Thru Unity Examples And My First App</title>
		<link>http://www.bleepng.com/blog/2009/05/digging-thru-unity-examples-and-my-first-app/</link>
		<comments>http://www.bleepng.com/blog/2009/05/digging-thru-unity-examples-and-my-first-app/#comments</comments>
		<pubDate>Wed, 20 May 2009 17:14:47 +0000</pubDate>
		<dc:creator>meanstreak</dc:creator>
		
		<category><![CDATA[Unity]]></category>

		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.bleepng.com/blog/?p=17</guid>
		<description><![CDATA[Yesterday I spent some time reading thru posts on the Unity forums and looking over the scripts and project structures in the iPhone-Match Unity game example and the TouchPhases mini-tutorial.
The iPhone-Match example is especially helpful as it provides a good example of a complex project structure and has some useful java scripts (tho they&#8217;re not [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I spent some time reading thru posts on the Unity forums and looking over the scripts and project structures in the<a title="iPhone-Match" href="http://unity3d.com/support/resources/example-projects/iphone-examples"> iPhone-Match</a> Unity game example and the <a title="touch phase mini-tutorial" href="http://blogs.unity3d.com/2009/05/07/my-first-post-and-a-mini-tutorial/">TouchPhases mini-tutorial</a>.</p>
<p>The iPhone-Match example is especially helpful as it provides a good example of a complex project structure and has some useful java scripts (tho they&#8217;re not very well commented).  By digging around in the files to see how they do certain things, I was able to get my first &#8220;hello world&#8221; iPhone app working .</p>
<p>I&#8217;m so excited with how this simple example app turned out, that I&#8217;m planning to create a tutorial to document the process.</p>
<p>Today&#8217;s relevant links:</p>
<p><a href="http://ethicalgames.wordpress.com/2009/01/14/unity-for-flash-developers-tutorial-1/">http://ethicalgames.wordpress.com/2009/01/14/unity-for-flash-developers-tutorial-1/</a> &#8220;Unity for Flash developers tutorials&#8221;</p>
<p><a href="http://blogs.unity3d.com/2009/05/07/my-first-post-and-a-mini-tutorial/">http://blogs.unity3d.com/2009/05/07/my-first-post-and-a-mini-tutorial/</a> &#8220;TouchPhases mini-tutorial&#8221;</p>
<p><a href="http://unity3d.com/support/documentation/Manual/Character-Animation.html">http://unity3d.com/support/documentation/Manual/Character-Animation.html</a></p>
<p><a href="http://forum.unity3d.com/viewtopic.php?t=24609">http://forum.unity3d.com/viewtopic.php?t=24609</a> &#8220;Unity iPhone Newbie Tutorial Series&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bleepng.com/blog/2009/05/digging-thru-unity-examples-and-my-first-app/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Example Unity Apps Successfully Installed</title>
		<link>http://www.bleepng.com/blog/2009/05/example-unity-apps-successfully-installed/</link>
		<comments>http://www.bleepng.com/blog/2009/05/example-unity-apps-successfully-installed/#comments</comments>
		<pubDate>Tue, 19 May 2009 06:17:57 +0000</pubDate>
		<dc:creator>meanstreak</dc:creator>
		
		<category><![CDATA[Unity]]></category>

		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.bleepng.com/blog/?p=12</guid>
		<description><![CDATA[I successfully installed 2 Unity iPhone example Apps on my iPhone tonight &#8212; Tunnel Runner and Roll-a-Ball.
My worry about having to restore the iPhone to run dev apps was apparently misguided.  I was able to set up the Provisioning Profile and install it to my iPhone without too much trouble &#8212; I followed the &#8220;Assistant&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>I successfully installed 2 Unity iPhone example Apps on my iPhone tonight &#8212; Tunnel Runner and Roll-a-Ball.</p>
<p>My worry about having to restore the iPhone to run dev apps was apparently misguided.  I was able to set up the Provisioning Profile and install it to my iPhone without too much trouble &#8212; I followed the &#8220;Assistant&#8221; on the Program Portal Home page which made creating an App ID and the Provisioning Profile  pretty easy.  The other day I was following along with the PDF I mentioned in my previous post, and it was that doc that lead me to believe I had to restore my iPhone. I guess that&#8217;s what I get for reading the directions.  heh</p>
<p>Anyway, I&#8217;m in business as far as connecting Unity to Xcode and my iPhone.  Now I just need to work on my own Apps!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bleepng.com/blog/2009/05/example-unity-apps-successfully-installed/feed/</wfw:commentRss>
		</item>
		<item>
		<title>My First Potential Snag</title>
		<link>http://www.bleepng.com/blog/2009/05/my-first-potential-snag/</link>
		<comments>http://www.bleepng.com/blog/2009/05/my-first-potential-snag/#comments</comments>
		<pubDate>Fri, 15 May 2009 22:58:47 +0000</pubDate>
		<dc:creator>meanstreak</dc:creator>
		
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.bleepng.com/blog/?p=6</guid>
		<description><![CDATA[I hit my first (feels like major) snag today.  I got pretty far along with doing all the crazy setup hoop jumping that&#8217;s required before you can test apps on an iPhone: setup the Development Certificate, added my iPhone&#8217;s UDID to the Devices, and created an App ID.
I followed the instructions in this PDF for [...]]]></description>
			<content:encoded><![CDATA[<p>I hit my first (feels like major) snag today.  I got pretty far along with doing all the crazy setup hoop jumping that&#8217;s required before you can test apps on an iPhone: setup the Development Certificate, added my iPhone&#8217;s UDID to the Devices, and created an App ID.</p>
<p>I followed the instructions in this PDF for the most part: <a href="http://adcdownload.apple.com/iphone/iphone_developer_program_user_guide/iphone_developer_program_user_guide__standard_program_v2.4.pdf">iPhone Developer Program Users Guide </a>(warning, 7.2MB file)</p>
<p>BUT the snag came when I got to the &#8220;Installing iPhone OS&#8221; part:  &#8221;<em>To run your code on an Apple device, you will need to install iPhone OS onto each development device and &#8220;restore&#8221; each device to a development state.</em>&#8221; Yikes!</p>
<p>I&#8217;m still looking into this bit and hoping that maybe there&#8217;s a simpler way to setup my phone for development without having to go thru all that hassle.  We&#8217;ll see.</p>
<p>The real pain with having to restore, is that my iPhone is synched with the music and stuff on my PC, and having to restore it using the Mac means I&#8217;ll have to move all my media over to it.  Maybe I should just buy a Touch for development use?!  heh nah&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bleepng.com/blog/2009/05/my-first-potential-snag/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Bleepng Blog and iPhone Dev Kickoff Post</title>
		<link>http://www.bleepng.com/blog/2009/05/bleepng-blog-and-iphone-dev-kickoff-post/</link>
		<comments>http://www.bleepng.com/blog/2009/05/bleepng-blog-and-iphone-dev-kickoff-post/#comments</comments>
		<pubDate>Fri, 15 May 2009 04:20:29 +0000</pubDate>
		<dc:creator>meanstreak</dc:creator>
		
		<category><![CDATA[Unity]]></category>

		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.bleepng.com/blog/?p=3</guid>
		<description><![CDATA[I&#8217;ll be using this blog to track my teams progress while we develop our first iPhone game using the Unity for iPhone engine and tools.  We haven&#8217;t shipped an iPhone game and we&#8217;ve only just started using the Unity tools.  If I manage to keep regular with updates, this site should provide a pretty good [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll be using this blog to track my teams progress while we develop our first iPhone game using the Unity for iPhone engine and tools.  We haven&#8217;t shipped an iPhone game and we&#8217;ve only just started using the Unity tools.  If I manage to keep regular with updates, this site should provide a pretty good overview of our experiences thruout the dev cycle.</p>
<p>Up to this point, I&#8217;ve brought about a 1/2 dozen iPhone game and app designs to 1st pass, more or less.  Some of them could turn out to be good games, others we&#8217;re not so sure of yet.  But we&#8217;ve picked 1 that we&#8217;re going to move forward with, at least for now.  We should have basic gameplay working in a week or so, then we&#8217;ll get a better idea if the core design has fun potential.</p>
<p>A few weeks back I picked up a refurb macbook 13&#8243;, and installed the iPhone SDK (Build: 9M2621a).  Then today I got around to signing up to the iPhone Developer program - $99 + tax (tax?) as an Individual.</p>
<p>Yesterday I installed Unity for iPhone (30 day eval) and played around with it a little bit (I also tried Unity3D a few weeks ago, did some tutorials).  I downloaded a few example iPhone apps and poked around in the UI and scripting docs for a bit.  I was ready to build and send one to my phone but then I had to go thru all the dev signup I mentioned before.</p>
<p>Once I got my Developer account, I found that I still have to: obtain a certificate, create an Apple ID, assign my device, and create a provisioning profile.  Sheesh.  And all of that stuff is pretty complicated and not very clearly described.  Anyway, I ran out of time so I&#8217;ll probably get to all that tomorrow.  Then(!) I&#8217;ll be able to build one of the sameple Unity apps and upload it to my phone.</p>
<p>Today&#8217;s relevant links:</p>
<p><a href="http://developer.apple.com/iphone/index.action" target="_self">http://developer.apple.com/iphone/index.action</a></p>
<p><a href="http://developer.apple.com/iphone/manage/overview/index.action">http://developer.apple.com/iphone/manage/overview/index.action</a></p>
<p><a href="http://www.smashingmagazine.com/">http://www.smashingmagazine.com/</a></p>
<p><a href="http://twitter.com/meanstreak">http://twitter.com/meanstreak</a> (oh, and I fired up my twitter account for the first time in a year)</p>
<p><a href="http://unity3d.com/support/resources/example-projects/iphone-examples">http://unity3d.com/support/resources/example-projects/iphone-examples</a></p>
<p><a href="https://www.unitydeveloper.com/shop/home.php">https://www.unitydeveloper.com/shop/home.php<br />
</a></p>
<p><a href="http://forum.unity3d.com/">http://forum.unity3d.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bleepng.com/blog/2009/05/bleepng-blog-and-iphone-dev-kickoff-post/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
