Archive for the ‘Papervision’ Category
importing dae Tutorial
Mouse and Keyboard interaction Tutorial
When creating models/importing models into flash, and testing code in run time etc, sometimes it is very usefull to have Statistics displayed on the runtime page, to see how well your program is running, any memory leaks etc..
import org.papervision3d.view.stats.StatsView;
If you have employed BasicView for your scene setup, add
private var view:StatsView;
in your class, and then call it using:
addChild(new StatsView(renderer));
Thats it! very simple, you should end up with something looking like this in your window
- Try and keep your models as simple as possible without loosing much on detail (obviously some sacrifices have to be made).
- When exporting to a DAE file, try and use a model that is newly made, rather than editing one that is already textured and in a scene with other objects.
- DO NOT, texture your objects, until you are ready to add your UVW map, this will avoid confusion in the DAE, where max has exported the files, with paths to textures that you no longer use, this will throw errors when testing movie in Actionscript.
- Having a clean model, with few gemoetries and one UVW map will help reduce complications and errors in the long run – trust me, im speaking from experiance!
- .DAE files, can be opened in Notepad, and edited – do not edit if you are unsure of what to do, you may end up corrupting your file, and having to re-export.
- Notepad2, is a lot better than Notepad – with syntax highliting and numbered lines, get it here, its free!
If you have any tips you would like to add, please feel free to leave them in the comments!
This tutorial is an expansion on Loading 3D objects created in Max (using COLLADA)…
var myobjMaterials:MaterialsList = new MaterialsList();myobjMaterials.addMaterial(new BitmapMaterial(new sacktexture(1024, 1024)));
and thats all there is to it!
This tutorial will show you how to basically import a 3D object into Flash, using Papervision.
IF you are completely new to this (i.e. need to know how to set up flash and PV3D, then please follow this tutorial steps 1-4 and read the beginners guide to creating your first 3D shapes here – if you want to know how to export 3D files into the COLLADA .DAE format that papervision read steps 2 -3 here.
package{ import org.papervision3d.view.BasicView; //For importing objects import org.papervision3d.objects.parsers.Collada; import org.papervision3d.objects.parsers.DAE; import org.papervision3d.objects.DisplayObject3D; [SWF(width="640", height="320", backgroundColor="#000000", frameRate="60")] public class import3D extends BasicView { public function import3D() { var myFirstObject= new Collada("myfirstobject.dae"); //Set different scales, if your models is too small or too big myFirstObject.scaleX = 8; myFirstObject.scaleY = 8; myFirstObject.scaleZ = 8; //rotate object if you want it at a different angle myFirstObject.rotationX+=30; myFirstObject.rotationY+=30; scene.addChild(myFirstObject); startRendering(); } } }
And thats all there is to it! – very simple once you know how – keep an eye out for the next tutorial – TEXTURING!