{"id":5601,"date":"2011-08-31T21:47:33","date_gmt":"2011-08-31T19:47:33","guid":{"rendered":"http:\/\/fdt.powerflasher.com\/blog\/?p=5601"},"modified":"2011-10-26T13:47:56","modified_gmt":"2011-10-26T11:47:56","slug":"setting-up-away-3d-4-0-loading-a-3d-model","status":"publish","type":"post","link":"https:\/\/fdt.powerflasher.com\/blog\/2011\/08\/setting-up-away-3d-4-0-loading-a-3d-model\/","title":{"rendered":"Setting Up Away 3D 4.0 &#038; Loading A 3D Model"},"content":{"rendered":"\n<p>Today I&#8217;d like to release a quick demo about a setup for using Away3D 4.0 with your FDT projects. We&#8217;ll even have an example of loading a Wavefront .obj file and using it in your project. Before we get started, I&#8217;d like to thank <a href=\"https:\/\/plus.google.com\/115670868591924579552\/posts\">Michael Plank<\/a> for providing the sample project and it&#8217;s assets. The 3D ship model that we&#8217;re loading is also from his upcoming game <a href=\"http:\/\/deltastrike.org\/\">Delta Strike<\/a>. The game is really looking great and I recommend everyone check it out.<\/p>\n<img src='https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2011\/08\/ds-440x223.png' alt='' width='440' height='223' \/>\n<h2 style=\"text-align: center;\">Sample Project<\/h2>\n<p style=\"text-align: center;\"><a href=\"http:\/\/github.com\/downloads\/Powerflasher\/FDT-Resources\/fdt_away_3d_demo.zip\"><img loading=\"lazy\" class=\"aligncenter\" title=\"Download Project Source\" src=\"http:\/\/fdt.powerflasher.com\/w\/images\/3\/3d\/Download_soruce_files.png\" alt=\"\" width=\"231\" height=\"37\" \/><\/a><\/p>\n<p>If you haven&#8217;t setup your SDK for AIR 3.0 Beta2 and Flash Player 11 Beta2, you&#8217;ll need to do that. You may also get an SDK warning if you&#8217;re SDK has a different name. If you know you have you&#8217;re SDK setup up for AIR 3.0 and Flash Player 11, then go ahead and reassign the SDK to the one on your system. Learn more about SDK management <a href=\"http:\/\/fdt.powerflasher.com\/docs\/SDK_Management\" target=\"_blank\">here<\/a>.<\/p>\n<h2 style=\"text-align: center;\">Video<\/h2>\n<p>I&#8217;ve created a quick video that goes through the process. You can watch it below. If you prefer text, that is included further down.<\/p>\n<p><iframe loading=\"lazy\" src=\"\/\/player.vimeo.com\/video\/28424843\" width=\"500\" height=\"281\" frameborder=\"0\" title=\"Setting Up Away 3D 4.0 &amp; Loading A 3D Model\" webkitallowfullscreen mozallowfullscreen allowfullscreen><\/iframe><\/p>\n<h2 style=\"text-align: center;\">Setting Up Your Away 3d Library<\/h2>\n<h3 style=\"text-align: center;\">Create Your Library Project<\/h3>\n<p>Before downloading the latest Away 3D source code, we need a place to put it. \u00a0Fire up FDT and create an empty project and name it &#8216;away3D&#8217;. Once that&#8217;s done, select an SDK that has been prepped with the latest Flash Platform releases (<a href=\"http:\/\/fdt.powerflasher.com\/blog\/2011\/08\/setting-up-fdt-for-air-3-and-flash-player-11\/\" target=\"_blank\">see a previous blog post about it<\/a>).<\/p>\n\n<p>One that is done, go ahead and delete all the folders in the project. \u00a0Since this is just going to be used for reference, we don&#8217;t need any of those folders &#8211; just somewhere to place our source code.<\/p>\n<img src='https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2011\/08\/demo_004-440x287.png' alt='' width='440' height='287' \/>\n<h3 style=\"text-align: center;\">Download Away3D 4.0<\/h3>\n<p>If you have a github account and use OSX, using the Github OSX client is a great way to make sure you always have the latest Away 3D library. Do this by navigating to the <a href=\"https:\/\/github.com\/away3d\/away3d-core-fp11\" target=\"_blank\">Away 3D repository<\/a> and choosing &#8216;Clone in Mac&#8217;. When the Github client opens, navigate to your &#8216;away3D&#8217; project and download it to there.<\/p>\n<img src='https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2011\/08\/demo_005-440x542.png' alt='' width='440' height='542' \/>\n<p>For windows users or anyone who isn&#8217;t interested in using the OSX Github client can either use the command line to download the library, or simply download the library as a .zip.<\/p>\n<h3 style=\"text-align: center;\">Setup Your Away3D Library Project<\/h3>\n<p>Once you have the away3D library in your project, add the nested &#8216;src&#8217; folder as a source folder to your project. Once this is done, let&#8217;s go ahead and turn off errors for this project. Do this by navigating to your project&#8217;s settings and uncheck &#8216;Generate Problems \/ Tasks&#8217;. This will help keep things more tidy as FDT will not worry about checking this project for warnings or errors.<br \/>\n<img src='https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2011\/08\/demo_009-440x688.png' alt='' width='440' height='688' \/><\/p>\n<p>Now your library project is setup.<\/p>\n<h2 style=\"text-align: center;\">Import and Run The Sample Project<\/h2>\n<p>Next, simply import the project into your workspace (see this <a href=\"http:\/\/fdt.powerflasher.com\/docs\/Sharing_and_Archiving_Projects#Importing_Projects\" target=\"_blank\">wiki article<\/a> on how to do that). With the project open you should see that it is already looking for a project named &#8216;away3D&#8217;.<\/p>\n<img src='https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2011\/08\/demo_011-440x239.png' alt='' width='440' height='239' \/>\n<p>If you have named your Away3D library project with a different name, link to that instead (again see our <a href=\"http:\/\/fdt.powerflasher.com\/docs\/Project_References#Video\" target=\"_blank\">Project References wiki article<\/a> on how to do that).<\/p>\n<p><img src='https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2011\/08\/demo_013.png' alt='' width='397' height='305' \/><br \/>\nTo run this project simply open the Main.as file, right click on the file on the Editor and choose Debug As&gt;FDT SWF Application. FDT will take a second to compile (the first compile will take a few seconds) and then the application will run.<\/p>\n<img src='https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2011\/08\/demo_0141-440x532.png' alt='' width='440' height='532' \/>\n<h2 style=\"text-align: center;\">Analyzing The Setup<\/h2>\n<p>There are a few important notes when working with Away3d 4.0 and the latest SDKs. You&#8217;ll first have to download the latest beta SDKs, of course, but you need to make sure you have the proper compiler and embedding arguments. When targeting this new Flash Player, you&#8217;ll need to make sure you have the &#8216;-swf-version=13&#8217; compiler argument.\u00a0\u00a0If you&#8217;re using the sample project, it will already be added.<\/p>\n<img src='https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2011\/08\/compiler_args-440x355.png' alt='' width='440' height='355' \/>\n<p style=\"text-align: left;\">Another &#8216;gotcha&#8217; is to make sure you&#8217;re properly embedded the .SWF into an HTML page. The trick here is the &#8216;params.wmode = &#8220;direct&#8221;;&#8217; argument.<\/p>\n<img src='https:\/\/fdt.powerflasher.com\/blog\/wp-content\/uploads\/2011\/08\/embed-440x187.png' alt='' width='440' height='187' \/>\n<p style=\"text-align: left;\">All the test is in the code, so check it out. You&#8217;ll see how the 3D model (a Wavefront .OBJ file) is embedded into your application, and then skinned and lit. \u00a0It&#8217;s surprisingly easy. Enjoy<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today I&#8217;d like to release a quick demo about a setup for using Away3D 4.0 with your FDT projects. We&#8217;ll even have an example of loading a Wavefront .obj file and using it in your project. <\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,4,332,11,12],"tags":[401],"_links":{"self":[{"href":"https:\/\/fdt.powerflasher.com\/blog\/wp-json\/wp\/v2\/posts\/5601"}],"collection":[{"href":"https:\/\/fdt.powerflasher.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fdt.powerflasher.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fdt.powerflasher.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/fdt.powerflasher.com\/blog\/wp-json\/wp\/v2\/comments?post=5601"}],"version-history":[{"count":38,"href":"https:\/\/fdt.powerflasher.com\/blog\/wp-json\/wp\/v2\/posts\/5601\/revisions"}],"predecessor-version":[{"id":6467,"href":"https:\/\/fdt.powerflasher.com\/blog\/wp-json\/wp\/v2\/posts\/5601\/revisions\/6467"}],"wp:attachment":[{"href":"https:\/\/fdt.powerflasher.com\/blog\/wp-json\/wp\/v2\/media?parent=5601"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fdt.powerflasher.com\/blog\/wp-json\/wp\/v2\/categories?post=5601"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fdt.powerflasher.com\/blog\/wp-json\/wp\/v2\/tags?post=5601"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}