xbox live gold membership generator chrysler financial make a payment jeans for big thighs small waist desktop backgrounds for macbook pro windows xp internet backgammon os x snow leopard server serial number canon powershot sx20 is price in malaysia summer 2010 fashion internships in new york snowboarding games online free guitar hero world tour unlock all songs cheat buy commercial truck tires online yamaha atv parts yamaha outboards troubleshooting samsung lcd tv problems black screen dress up barbie games to play satellite tv for pc elite edition password subaru outback 2010 review canada diamond solitaire engagement rings monster truck games online for kids watch summer heights high episode 1 online samsung lcd tv troubleshooting no picture nikon d5000 prices in dubai limewire basic for mac os x bridezillas where are they now karee rpg maker 2003 rtp cheap dresses for juniors online wireless headphones for ipod touch 1g youtube malayalam movies xbox 720 pics xbox 360 hard drive transfer kit gamestop student doctor network interview feedback compaq mini netbook with intel atom processor used pool tables for sale in michigan download auctioneer addon for wow chrysler town and country parts mitsubishi lancer evolution x mr pizza hut coupons online codes 2001 chrysler sebring convertible parts boots online shopping ireland canon rebel eos manual ds6041 honda civic hatchback parts for sale skype download for blackberry curve 8520 famous love quotes from the notebook healthy pizza dough no yeast pizza hut menu with prices canada wedding invitation wording divorced parents mdi reader download jar software free download for mobile travelocity gnome commercial song cruises only coupons best screensavers for mac snow leopard xbox 360 games on demand hack student loans without cosigner and no credit dvd ripper for mac freeware jcpenney furniture outlet atlanta ga cocktail dresses online cheap youtube video to mp3 converter for mac paid summer internships new york city radiohead tour 2010 north america dodge journey 2009 sxt housecall antivirus helmets for motorcycles in india free playstation network card generator bathroom shower tiles pictures nintendo ds roms free download english canon rebel xti vs nikon d5000 best wireless headphones for tv listening porsche 911 turbo for sale craigslist snowflake patterns crochet backpacks for college radio disney live stream wireless n router review cnet truck mount carpet cleaning machines for sale subaru 22b sti for sale commercial carpet steam cleaning machines hairstyles for women over 60 pictures bride wars soundtrack listen wireless n router range comparison free elementary career interest inventory bmw m3 for sale cheap tires plus locations in florida next radiohead tour 2010 pontiac grand prix gtp supercharged transmission websites like craigslist personals samsung i8000 omnia ii reviews gps maps for blackberry playstation 3 gamestop trade in value barcode scanner java api laptops cheapest uk project portfolio management software open source radiohead tour 2010 uk dating simulation games for girls online porsche carrera gt for sale in us pontiac gto judge 1969 for sale land rover freelander parts diagram samsung plasma tv calibration settings honda motorcycle parts warehouse honda generators eu2000i rpg maker vx sprite generator download snowboarding jackets on sale for women replica daft punk helmets for sale portfolio lighting replacement parts playstation 3 network card generator 2010 mazda 3 replacement parts infinity ward nat strict pc jeep wrangler unlimited for sale in iowa rpg maker vx activation code free nissan skyline gtr for sale in florida dvdfab registration key generator dvdfab 6 keygen download download snowboarding games for pc porsche cayenne 2010 prices hp psc 1610 scanner software for vista autotune 5 download for windows princess cut diamond engagement rings cheap free strip blackjack canon rebel xsi tutorial video murray riding lawn mower parts diagram nintendo ds roms download free xbox live ban wave finished glassjaw tour dates 2010 buy cigarettes online paypal mazda 626 manual transmission guitar pro 6 release date bmw m3 2010 prices mazda reviews mercedes benz amg black edition 2011 cadillac cts v coupe motorcycle repair manuals for free subaru forester parts catalog wedding reception invitation wording examples skype for mac snow leopard movies online streaming new moon dvd ripper for mac snow leopard playstation emulator vista download software architecture in practice ppt shirt printing machines for sale hyundai santa fe 2010 release date samsung mythic a897 price in india rolex prices datejust flash player 9 free download firefox marlboro cigarettes online usa radio stations online free hip hop mitsubishi lancer evolution for sale used volkswagen jetta sportwagen tdi for sale honda financial services phone number handbags leather manufacturer mazda tribute parts diagram wedding vows traditional catholic tattoo quote ideas for girls logo creator software free download canon rebel xti vs nikon d3000 nissan skyline gtr for sale in california tools download free skype video conference 3 people templates for powerpoint games kids snow boots clearance uk jeep grand cherokee reviews 2000 design your own wedding dress online free game xbox tips toyota prius prices paid canon s90 review ken rockwell radiohead tour dates 2010 furnitureland south bankruptcy skinny jeans for men on sale crochet snowflake patterns free pizza hut menu prices us design your own wedding dress for free wedding shower favors homemade 1971 volkswagen beetle convertible for sale wireless bridge linksys wrt160n snowboarding gloves or mittens gps coordinates conversion formula mercedes benz parts online uk jaguar xk8 performance parts snowboard pants sale nikon d60 manual download free land rover defender 110 for sale travelers insurance commercial song worry mobile satellite internet service providers tattoo wedding rings pictures furniture liquidators denver download logo maker freeware sony ereader touch backlight download desktop destroyer 2 chicken carnage how to make pizza dough without yeast and baking powder skype download vista 64 bit cypress hill torrent summer paid internships 2010 design your own engagement ring tiffany prom dresses for prom 2010 modem commands us robotics xbox 360 e73 repair guide roses are red poems funny crocodile monitor lizards for sale marriage counseling infidelity wedding dresses pictures for men dvdfab 6 platinum registration key master bathroom renovation ideas warcraft 3 cd key finder tires plus corporate headquarters sony reader vs kindle vs nook sony vegas 9 serial number free toyota corolla parts catalog playstation emulator mac os x snow leopard guitar tuner drop c tuning mitsubishi lancer ralliart specs skype phone wifi dress up games and makeover games and cooking games tattoo ideas for girls wrist yamaha baby grand piano for sale compaq presario c700 drivers for xp suzuki sidekick parts manual templates for resumes for teachers samsung mythic a897 black wifi porsche cayenne forum italian pizza recipes dough nintendo ds emulator for iphone 3g golf digest hot list 2010 irons toyota oem parts discount winter olympics history wow cataclysm worgen druid forms famous movie quotes from the 80s gps maps free download tomtom wedding ceremony songs christian sony vaio recovery disk free download laminate flooring installation instructions pergo caribbean weather forecast subaru impreza wrx sti for sale in canada toyota forklift parts catalog skype emoticons hidden volkswagen tiguan review top gear cable modem hacking software sofas direct from factory wholesale handbags designer inspired kawasaki mule parts diagram antique harley davidson motorcycle parts sample resume restaurant waitress monitor audio rx8 test logo design freeware download honda civic 2010 price egyptian arts and crafts for kids example career essays tattoos ideas for girls pictures flooring options for screened porch toyota recall gas pedals honda accord forum 7th gen toyota camry recall 2009 guitar tabs for beginners acoustic mazda rx8 performance parts tattoos quotes for guys guitar tuner widget os x suzuki gsxr motorcycles for sale xbox 360 games torrent tracker volkswagen tiguan 2010 release date used mercedes amg for sale yamaha vmax motorcycles for sale harley davidson sportster parts and accessories snowboard pants men toyota corolla floor mat recall football fanatics coupon code 20 off sofa beds for sale in san diego ca sony psp 3000 games free download dresses for prom under 100 dollars latin tattoo quote ideas subaru wrx parts catalog grassroots lobbying examples mac logo creator freeware hyundai genesis coupe review chevrolet tahoe police package for sale toyota center seating chart 3d download gps maps europe lawnmower man game jaguar cars for sale on ebay warcraft 3 cheats reign of chaos suzuki grand vitara parts online subaru forester forum singapore saturn ion performance parts xbox 360 transfer kit gamestop jeans size chart forever 21 beginner guitar chord chart printable winter olympics 2010 tv coverage mercedes parts hardware temperature monitor windows 7 mitsubishi outlander 2010 commercial song craftsman tool boxes on wheels illuminated bathroom mirrors with shelf subaru baja turbo mpg dresses to wear to a wedding games for girls flight attendant mile high club sony vegas free download for mac suzuki samurai engine swap kit jeep grand cherokee 2011 release date yamaha atvs for sale cheap toyota venza 2010 hybrid 1998 mitsubishi eclipse spyder parts guitar chord chart finger position guitar tabs for sweet home alabama for beginners toyota recalls rav4 famous movie quotes quiz toyota body parts used guest bathroom color ideas mercedes benz sl55 amg price xbox 360 elite vs ps3 specs jeanstar jeans macys toyota recall list accelerator installing laminate flooring on stairs video harley davidson accessories for dogs guitar chord chart finger placement free soccer drills for 4 year olds dodge charger srt8 for sale used perfume outlet online snow leopard hackintosh laptop compaq presario v2000 laptop motherboard rpg maker vx resources faces warcraft 3 download free for mac tattoos for guys forearms kitchenaid dishwasher parts diagram mitsubishi parts oem guitar pro torrent mac toyota land cruiser parts and accessories modern wedding invitation wording examples lexus is 250 for sale by owner animation factory essential collection honda generators prices tattoo quote ideas for men famous funny poems about school software testing tutorials for beginners pdf chrysler 300 accessories canada cruises only coupon code garden of eden key west web cam summer internships for college students 2010 invoice templates free microsoft word jeep wrangler unlimited hardtop volkswagen gti 2010 price volkswagen beetle convertible pink mitsubishi evo 8 mr for sale winter jackets for men sale winter bells game cheat sony ericsson equinox reviews samsung moment vs htc hero comparison replica cowboy guns computer science resume objective dvdfab registration key 6 harley oem parts online 2000 jaguar s type parts clothes horse store samsung omnia i910 firmware update download snowflake patterns photoshop saturn vue transmission problems canon powershot a480 manual pdf biketoberfest 2009 pictures famous deaf people in history glass bongs online store gamecube emulator mac os x 2005 volkswagen beetle convertible for sale mitsubishi eclipse spyder body kits kia sportage 2008 problems coach shoes on sale at dillards wedding dresses pictures indian desktop wallpaper for macbook pro software manual testing interview questions hair color pictures highlights guitar chord chart poster famous short funny poems dvd shrink free download for mac mattress firm clearance center toyota tacoma lift kits 2wd world war 2 replica cap guns toyota camry parts for sale warcraft 2 tides of darkness mac download unblock facebook proxy at school ford trucks for sale in florida mitsubishi electric air conditioning remote control jeep grand cherokee 2011 video nissan versa hatchback reviews 2010 laminate flooring installation costs toyota camry 2010 recall mercedes e63 amg wagon for sale volkswagen passat cc 2010 famous american ceramic artists facebook layouts for mac empire carpeting reviews tattoo ideas for men quotes biker chicks photos college football recruiting rankings 2011 isuzu trooper engine diagram cable tv providers by zip code daft punk helmets for sale equalizer software mazda rx 8 r3 body kit replica cap guns snow white and the seven dwarfs story script linux commands list pdf free tattoo cursive lettering bathroom wall tile design ideas famous love poems sonnets tattoo script lettering alphabet satellite internet connection wwe dvd release schedule 2010 linux ubuntu beryl download free funny wedding vows write your own compaq presario c700 specifications movie replica airsoft guns compaq presario f700 drivers for windows 7 winter olympics history wiki summer heights high quotes jonah takalua used opel cars for sale in germany bathroom vanities cabinets wireless router booster homemade acoustic guitar scales beginners mercedes benz e63 amg coupe volkswagen parts diagrams software testing life cycle flow chart bicycles for sale at walmart toyota recall 2009 list apartments for rent in philadelphia no credit check why is flash flash revolution down used pool tables for sale dallas tx porsche boxster spyder 2010 guitar power chords chart t shirt dress sewing pattern youtube indian movies songs the jewelry exchange complaints hyundai elantra 2010 mpg compaq presario v6000 specs toyota tacoma used 4x4 mazda 626 parts online list of toyota recall september 2009 warcraft 3 cd key battlenet custom jeep cherokee bumpers famous poems about death and loss furniture factory outlet missouri suzuki sx4 forum toyota tacoma 2010 diesel used mud tires for sale cheap girls pantsed and wedgied pics chrysler sebring parts diagram minivan gas mileage comparison chart mens underwear blogspot vinyl siding colors pictures harley davidson parts made in china dvd decrypter download 64 bit poster templates free powerpoint logo creator freeware mac linux mint download mirror jewelry instructions mercedes benz accessories bluetooth wow cataclysm release date rumors jaguar xj 2010 test drive mitsubishi lancer evolution x for sale online rpg space star wars designer wedding dresses with sleeves famous historical hispanic people rolex submariner price used subaru outback gas mileage guitar chords chart printable facebook login proxy chrysler sebring 2008 owners manual compaq mini 110c netbook canon g11 manual pdf hair color trends winter 2010 samsung impression covers pool table dimensions room size civilian contracting jobs overseas portfolio cases for modeling tattoos for guys chest xbox 720 real pictures recipes for chicken breast strips kitchen islands for sale in toronto bathroom corner vanity cabinets youtube full length movies malayalam volkswagen tiguan 2010 diesel summer internships for high school students 2010 samsung solstice a887 black wifi volkswagen jetta for sale by owner gps maps for blackberry 9000 pontiac grand prix for sale in michigan jaguar xf problems radio stations for sale california minivan with best gas mileage toyota sienna parts catalog sturgis biker chicks photos kawasaki ninja 250r mpg golf shoes closeouts volkswagen gti forum play pocket god online game mitsubishi eclipse parts oem flowers for algernon short story summary laptop computer deals walmart dvdfab 6 key siding colors home depot kitchen islands with breakfast bars subwoofer wiring calculator samsung eternity apps glass bongs and pipes for sale laptop computer deals under 400 wireless internet connection keeps dropping pokemon rpgs online best gps systems for truck drivers subaru legacy oem parts open gps tracker android toyota tacoma gas mileage basketball plays motion offense isuzu npr snow summit lift tickets coupons tattoo ideas for men forearm winter olympics 2014


6. Loading Complex Models

**Update
This tutorial has been updated:
view-update

Hi, Today we're going to modify the "Creating Objects" project again, this time to load a Collada Model file.

Loading Collada files is the fastest and easiest way in Papervision 3d to get a complex model into your scene. By changing a few lines in your code, we can quickly load a model of a cow and make it spin! The result will be this:

All that, in just a few lines of code!

Let's show you how to spin cows..

We'll need to use the org.papervision3d.objects.DisplayObject3D package to store our model in. This will store the geometry, materials and everything like the position and rotation. We'll also need the Collada file parser.. Change your import lines so they look like this:

import PaperBase;
import org.papervision3d.objects.DisplayObject3D;
import org.papervision3d.objects.parsers.Collada;

They're the only three imports needed!

Now, instead of making a cone, this time we're making a cow, so we change the "public var cone" line to this:

public var cow:DisplayObject3D;

So, that line tells our program that we want to store a DisplayObject3D in a variable called cow.

Now, in the init3d() function code we'll load the Collada file. I have the file stored on my server. You can download it if you want but this example will refer to the model on my server so it will work wherever. Change all of the code in "init3d" to this:

cow = new Collada("http://papervision2.com/wp-content/downloads/dae/cow.dae");
cow.moveDown(100);
cow.scale = 3;
cow.pitch(-30);
default_scene.addChild(cow);

Most of that code is just positioning the cow in the scene!
The first line of that code makes the cow variable load the Collada model file from my server. All of the parsing, getting the material and everything like that is done by the Collada package which is pretty neat!

We then move the cow down a bit, tilt her towards the camera, and add her to the scene.

All that's needed now is to rotate the cow each time the frame is processed. Simple! Change the code under "processFrame" so that it reads:

cow.yaw(5);

and you're all done!

My final code is here:

Actionscript:
  1. package {
  2.    
  3.     import PaperBase;
  4.     import org.papervision3d.objects.DisplayObject3D;
  5.     import org.papervision3d.objects.parsers.Collada;
  6.    
  7.     public class Main extends PaperBase {
  8.        
  9.         public var cow:DisplayObject3D;
  10.        
  11.         public function Main() {
  12.             init();
  13.         }
  14.        
  15.         override protected function init3d():void {
  16.             cow = new Collada("http://papervision2.com/wp-content/downloads/dae/cow.dae");
  17.             cow.moveDown(100);
  18.             cow.scale = 3;
  19.             cow.pitch( -30);
  20.             default_scene.addChild(cow);
  21.         }
  22.        
  23.         override protected function processFrame():void {
  24.             cow.yaw(5);
  25.         }
  26.        
  27.     }
  28.    
  29. }

Post to Twitter Post to Delicious Delicious Post to Digg Digg This Post Post to Facebook Facebook Post to StumbleUpon Stumble This Post

126 Responses to “6. Loading Complex Models”


  • EDIT: sorry the right thing is:

    mycollada.materials = mysecondmateriallist;

    But it doesn’t work anyway…

  • Thanks, but now what if you want to remove this model from the scene, load another one with its texture?
    And imagine we want to be able to browse a list of models… so after 20 loading, what will happen? It will probably be slow because of memory leaks in Papervision.

    Do you have a solution for that?

  • Hello,

    Excellent tutorial,

    I’m trying to load now a model that is animated via bones in Maya 2008.

    I read in Nabble that for animations, org.papervision3d.objects.parsers.DAE
    should be used:

    ————-START CODE——————-

    character = new DAE(true);
    character.load(“character.dae”);
    default_scene.addChild(character);

    ————-END CODE———————

    This results in the following Output:

    INFO: Papervision3D Public Beta 2.0 – Great White (September 9th, 2008)

    INFO: BitmapFileMaterial: Loading bitmap from Art/Textures/character1_color.jpg?nc=0.16253294749185443
    ERROR: BitmapFileMaterial: Unable to load file Art/Textures/character1_color.jpg?nc=0.16253294749185443
    INFO: DisplayObject3D: COLLADA_Scene
    INFO: DisplayObject3D: pCube1
    INFO: DisplayObject3D: transform2
    INFO: DisplayObject3D: pCylinder1
    INFO: DisplayObject3D: transform1
    INFO: DisplayObject3D: polySurface1

    Nothing happens… Is here any other way to load and play animations ?

  • Excellent tutorials Luke!

    I tried the code for this tutorial in Flash CS3… worked fine, but in the Output window I get these messages:

    INFO: Papervision3D Public Beta 2.0 – Great White (September 9th, 2008)

    INFO: DisplayObject3D: vsn-mats
    INFO: BitmapFileMaterial: Loading bitmap from http://papervision2.com/wp-content/downloads/dae/Cow.png
    ERROR: MaterialObject3D: transformUV() material.bitmap not found!
    ERROR: MaterialObject3D: transformUV() material.bitmap not found!
    ERROR: MaterialObject3D: transformUV() material.bitmap not found!
    ERROR: MaterialObject3D: transformUV() material.bitmap not found!

    ERROR: MaterialObject3D: transformUV() material.bitmap not found!

    Any idea what might have gone wrong?

  • I am sorry to bother you, but everytime i launch flashplayer to start the animation, i get several times this output:

    MaterialObject3D: transformUV() material.bitmap not found!

    Can you please indicate me what am i supposed to do? This is driving me crazy.
    It’s not a problem of this tutorial only, i got tha same output also in other tutorials where i used bitmap references.

    Thanks a lot!

  • I’m a newbie on this subject. I’m suing swift 3d to export some 3d designs, but I can’t get them to load using the sample above. Is there something that I have to do dae files?
    And thanks for the tutorials they’re nice

  • Hi everyone A big thank you for this wonderful site, it has helped me immensely

  • when i coped those codes into my FlashDevelp , the Output displayed : ERROR: MaterialObject3D: transformUV() material.bitmap not found! ,what’s wrong with it ?

  • To void getting the error: “ERROR: MaterialObject3D: transformUV() material.bitmap not found!” …don’t add the Collada to the scene until the material bitmap(s) have loaded.

    The error is caused by the fact that the cow material bitmap is still loading. (You might have noticed that the error stops firing once the bitmap loads).

    The most efficient way to wait for the bitmap to load, is to wait for the Collada object to dispatch the FileLoadEvent.COLLADA_MATERIALS_DONE, like so:

    cow.addEventListener(FileLoadEvent.COLLADA_MATERIALS_DONE, cowOnLoadCompleteHandler);

    …then do the addChild(cow) in the cowOnLoadCompleteHandler.

    (Note that FileLoadEvent.LOAD_COMPLETE fires too soon, before the bitmap loads, so DO NOT use it for this purpose.)

    (While discovering this, I found that polling the cow to wait for (cow.loaded && cow.materialsToLoad == 0) did the trick – but using the event is 100 times cleaner!)

    Cheers
    Toby

  • After following along it simply does not work. No error outputs, but nothing on the stage either. Any ideas?

  • Mant thanks for your great help in learning papervision

    I have the same problem others have mentioned but I have not seen a solution. The cow model loads fine but it is a mesh with no texture. This is the same even if I download the 2 files and use them locally.

    Please help!

  • Hello,

    The cow shows up in wireframe, but no texture. The output I’m receiving is:

    Papervision3D Public Alpha 3.0 – PapervisionX (18.09.08)

    DisplayObject3D: vsn-mats
    Collada material mat0 not found.

  • Oh , thank you !!!!haha

  • I tried this tutorial and I can see the cow, but no textures. The error is:

    WARNING: Collada material mat0 not found.

    Also, I see the model from the top down – NOT from the side view as you have it.

  • I get the same mat0 error not found, anyone solved this yet?

  • never mind.. solved it myself
    var mat:BitmapFileMaterial= new BitmapFileMaterial(“Cow.png”);
    var mp:MaterialsList = new MaterialsList();
    mp.addMaterial(mat, “mat0″);

  • after adding the material to mp, you should change your code to

    cow = new Collada(“http://papervision2.com/wp-content/downloads/dae/cow.dae”, mp);

  • provide more source code

    package {

    import PaperBase;
    import org.papervision3d.objects.DisplayObject3D;
    import org.papervision3d.objects.parsers.Collada;

    public class Main extends PaperBase {

    public var cow:DisplayObject3D;

    public function Main() {
    init();
    }

    override protected function init3d():void {
    cow = new Collada(“http://papervision2.com/wp-content/downloads/dae/cow.dae”);
    cow.moveDown(100);
    cow.scale = 3;
    cow.pitch( -30);
    default_scene.addChild(cow);
    }

    override protected function processFrame():void {
    cow.yaw(5);
    }

    }

    }

  • Here’s my entire code, extending BasicView instead of PaperBase. It works as the example swf:

    import flash.events.Event;
    import org.papervision3d.materials.BitmapFileMaterial;
    import org.papervision3d.materials.utils.MaterialsList;
    import org.papervision3d.objects.DisplayObject3D;
    import org.papervision3d.objects.parsers.Collada;
    import org.papervision3d.view.BasicView;

    public class ColladaTest extends BasicView {

    private var do3d:DisplayObject3D;
    private var mList:MaterialsList;

    public function ColladaTest() {
    init();
    }

    private function init():void {
    init3d();
    render();
    }

    private function init3d():void {
    mList = new MaterialsList();
    var mtl:BitmapFileMaterial = new BitmapFileMaterial(“http://papervision2.com/wp-content/downloads/dae/Cow.png”);
    mList.addMaterial(mtl, “mat0″);

    do3d = new Collada(“http://papervision2.com/wp-content/downloads/dae/cow.dae”, mList);
    do3d.moveDown(100);
    do3d.pitch(90);
    do3d.scale = 3;
    scene.addChild(do3d);

    addEventListener(Event.ENTER_FRAME, enterFrameHandler);
    }

    private function render():void {
    startRendering();
    }

    private function enterFrameHandler(evt:Event):void {
    do3d.yaw(1);
    }
    }

  • awesome thanks for the code.. I got an xwing model to show up and rotate in my space map thingy :)

  • How it is possible to embed .swf which uses external collada files with code that validates? Seems that collada files load not the first, but the second time the page loads with swfobject. The embed used on this site doesn’t validate.

  • Could you please publish short tutorial about creating collada object, such as this beauty cow?
    Many thanks for your work.

  • May I ask how would you use a collada file that is not hosted on the internet but on your own computer?

  • hi,
    thank you fpr this tutorial.
    But I have another question.
    I need to turn around the camera targeted on the object and not the object spinning around itself.
    How can i do this ?

  • Hey Karol,

    I was actually going to setup a tutorial on this very subject but the short answer to your solution would look as follows:

    protected var _camAng :Number = 90;
    static private var CAM_SPEED :Number = 120;
    static private var CAM_RADIUS :Number = 2000;

    protected function render(evt:Event):void
    {
    camera.lookAt(sphere);

    _camAng += Math.PI / CAM_SPEED;

    if (_camAng > Math.PI * 2)
    {
    _camAng = 0;
    }

    camera.x = Math.sin(_camAng) * CAM_RADIUS;
    camera.z = Math.cos(_camAng) * CAM_RADIUS;

    renderer.renderScene(scene, camera, viewport);
    }

    If anyone has a more elegant solution I would love to see. :)

    Charlie

  • OH THANK YOU…that was fast ! :)

    i have another little problem (very noob like)

    flashdevelop says “the path to flash.exe is not configured properly” than i go to settings, but i don’t know the path to it. It is not inside of the “Flex2SDK” dir, or?
    my windowssearch says there is n “flash.exe” but I installed everything needed I think.

  • My path is set to:

    C:\Program Files (x86)\Adobe\Adobe Flash CS3

    For Flex builder compiling it is set to:

    C:\Program Files (x86)\Adobe\Flex Builder 3\sdks\3.1.0

    Charlie

  • okay thank you, it works with:
    C:\Program Files (x86)\Adobe\Flex Builder 3\sdks\3.2.0

    but i get a plane white app.

    I’m very very new to actionscript, so can you please explain what to do with this code?

    1. Do I need the code version from the tutorial or one from the comments?
    2. what do I need to make this camera spin, I got your code:

    – you override an exsisting function “render()” ?
    – where do I have to declare the variables (in the main class or directly above the
    function?)
    – “cow.yaw(5);” this function I do not need, because I only want to move the camera not
    the object?

    Is this right ?

    I work with the new flashdevelop, have installed papaervision3D and Adobe Flex, and I have a .DAE Object from Lightwave 3D.

  • Sorry that code was not specific to this project but a general overview of how you would accomplish the task of rotation around a papervision object. A full tutorial is soon to come.

    Charlie

  • I’ll be the second to ask this: what program do you use to make the Collada files AND the png texture, and could you perhaps explain the process if it’s less than clear?

    Otherwise I’ve got this up and working with files on my computer now. You rock, Charlie ^.^

  • package
    {

    import PaperBase;
    import org.papervision3d.objects.DisplayObject3D;
    import org.papervision3d.objects.parsers.Collada;

    /**
    * …
    * @author admiraL_b
    */
    public class Main extends PaperBase
    {
    protected var sceneWidth:Number;
    protected var sceneHeight:Number;

    public var house:DisplayObject3D;

    public function Main()
    {

    sceneWidth = stage.stageWidth
    sceneHeight = stage.stageHeight;
    init(sceneWidth,sceneHeight);
    }

    override protected function init3d():void
    {
    house = new Collada(“bla.dae”);
    house.moveDown(100);
    house.scale = 1;
    house.pitch( -30);
    default_scene.addChild(house);
    }

    override protected function processFrame():void
    {
    house.yaw(5);
    }

    }

    }

    okay i got this code but i see nothing. Can someone tell me why? the DAE file is in the same directory. i tried also with an absolut path. Same problem. ??????????????????

    @Justin Redfield: The Collada files are from an exporter from a 3D Tool like Lightwave, 3DS Max or blender or sketchup. But to explain how o create complex models in thes tools would take very long. but there are many totorials on the web when you search for or there are also many complet DAE files on the web to use. PNG Textures you can also get from the internet when you search for, or you can create them by yourself with adobe photoshop or paint or whatever you like.

  • I need help, please :( !!!!!

  • Have you tried using a different model? If you can see a different model perhaps the issue is not with your code but with your model. Let me know,

    Charlie

  • hi
    i tried with the cow. that works, but 2 different models (both from lightwave 9.6; one a simple box and one a complex house) from the local directory it doesn’t work. I don’t know why

  • how should the path to the .dae file should be written ?

  • Download this:

    http://papervision2.com/wp-content/downloads/dae/cow.dae

    Save it locally to your computer as cow.dae

    Test this file locally. Once you get that working place YOUR model in the same directory.

    If locally the cow works and your model doesn’t then it is the model and not the code.

    If you need support on creating 3D Models unfortunately I won’t be able to offer any assistance.

    Charlie

  • hi I tried this, but if the cow DAE is in the same local directory, i see a white plane too.
    3D Models are no problem, i worked with lightwave a long time, i have problems with actionscipt/papervision

    this is the code, and it won’t work
    cow = new Collada(“cow.dae”, null, 2, false);

  • so i tried also uploading the cow on my server, but it is the same problem

  • okay when i upload the cow to my server it works (without textures, but this is because th .png is not on my server) so i think there has to be wsomething wrong with my DAE files

  • you can find 2 of my DAE files on

    http://karol.bplaced.net/media/bla.dae
    http://karol.bplaced.net/media/test.dae
    (doesn’t work)

    and the cow (works):
    http://karol.bplaced.net/media/cow.dae

    But e.g. the Swirl X3D Viewer shows me test.dae and cow.dae but not bla.dae
    Perhaps it is too complex, too much polygons (about 100, shouldn’t be too much)

  • Odd. I will look into the paperbase and if it is conflicting with the updated papervision code.

    Try this:

    package
    {
    import flash.events.Event;
    import org.papervision3d.objects.parsers.DAE;
    import org.papervision3d.view.BasicView;

    public class MainView extends BasicView
    {
    protected var model:DAE;
    public function MainView():void
    {

    model = new DAE(true, “mycam”, true);
    model.load(“bla.dae”);
    model.texturePath = “”;
    model.scale = 1

    model.moveDown(100);
    model.pitch( -30);;

    scene.addChild(model);
    camera.zoom = 100;
    startRendering();
    }
    override protected function onRenderTick(event:Event = null):void
    {
    super.onRenderTick(event);
    model.yaw(2);

    }
    }
    }

    Charlie

  • thank you very much for this code…but it is the same problem.
    I tried several DAE files, from my lightwave and free DAE files from the internet. Doesn’t work. Only the cow (no matter where on the internet it is, but locally the cow also doesn’t work)

  • i tried also:

    package
    {
    import flash.media.Camera;
    import PaperBase;
    import org.papervision3d.objects.DisplayObject3D;
    import org.papervision3d.objects.parsers.Collada;
    import org.papervision3d.objects.parsers.DAE;
    import org.papervision3d.view.BasicView;

    /**
    * date: 15/04/09
    * @author admiraL_b
    */
    public class Main extends PaperBase
    {
    protected var sceneWidth:Number;
    protected var sceneHeight:Number;

    public var house:DisplayObject3D;

    public function Main()
    {
    sceneWidth = stage.stageWidth
    sceneHeight = stage.stageHeight;
    init(sceneWidth,sceneHeight);
    }

    override protected function init3d():void
    {

    house = new DAE(true, “http://papervision2.com/wp-content/downloads/dae/cow.dae”, false);

    default_scene.addChild(house);
    }

    override protected function processFrame():void
    {
    house.yaw(5);
    }

    }

    }

    //but same problem, i get a blank window

  • does anyone know the solution or where to search for the problem…its important !!! thank you very much

  • Hello, I’ve been trying to load a collada made from Blender… I have four objects, each with a different material… The compiler tells me this:

    INFO: DisplayObject3D: Sphere
    WARNING: Collada material logo_Sphere_png not found.
    INFO: DisplayObject3D: CurveCircle
    WARNING: Collada material logo_CurveCircle1_png not found.
    INFO: DisplayObject3D: Curve_002
    WARNING: Collada material logo_Curve3_png not found.
    INFO: DisplayObject3D: Curve_001
    WARNING: Collada material logo_Curve_png not found.
    Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds.
    at org.papervision3d.objects.parsers::Collada/parseGeometry()
    at org.papervision3d.objects.parsers::Collada/parseNode()
    at org.papervision3d.objects.parsers::Collada/parseScene()
    at org.papervision3d.objects.parsers::Collada/buildCollada()
    at org.papervision3d.objects.parsers::Collada/onComplete()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

    So basically, it’s not finding my materials AND it’s taking to long to load…
    I havent been able to implement the material list into the code and make it work…
    SOMEONE PLEASE HELP!!! I’M GOING NUTS!!!!

    thanks, and awesome tut…

  • @Karol It’s quite possible that the Collada file is the wrong version. It should be v1.4 to work properly. Also, I’m not sure about Lightwave but I’ve read that in 3DS Max the default Collada exporter doesn’t produce files that will work with AS3. You could do what I did, which is port them into Blender (not a bad choice considering it’s free, but you’ll need to download Python for the scripts to work properly) and then export them as Collada 1.4, and there is a nice add-on for Blender that will actually make AS3 files out of your shape (great for making prims, but no animation yet), or there is a fix for the 3DS problem if you use that.

    And thanks for the answer on the ripping PNGs; I found out how to properly do it in Blender (though it’s about 10 steps more than I find reasonable)

  • it’s not so easy to import lightwave files to blender and export them to DAE.
    And it is not possible to create a model in blender for me inside of 1-2 days.

  • now i tried this once again:

    package
    {
    import flash.events.Event;
    import org.papervision3d.objects.parsers.DAE;
    import org.papervision3d.view.BasicView;

    public class Main extends BasicView
    {
    protected var model:DAE;
    public function Main():void
    {

    model = new DAE(true, “ding”, false);
    model.load(“http://karol.bplaced.net/media/bla.dae”);
    model.texturePath = “”;
    model.scale = 1

    model.moveDown(100);
    model.pitch( -30);;

    scene.addChild(model);
    camera.zoom = 100;
    startRendering();
    }
    override protected function onRenderTick(event:Event = null):void
    {
    super.onRenderTick(event);
    model.yaw(2);

    }
    }
    }

    // but i got the error:
    C:\Users\Leo\Desktop\flash\flashy\cone\main.as: Error: A file found in a source-path ‘main’ must have the same name as the class definition inside the file ‘Main’.

  • sorry for spamming so much :)

    YES IT WORKS !!!! with the last sourcecode i posted !!!

    thanks for the help guys!!!

    now i have to find out how to spin the camera around the objekt

Leave a Reply


Follow papervision2 on Twitter

Flash and the City banner
2010 Flash And The City Speaker

RSS Feed