views:

587

answers:

1

I am a newbie to Papervision. I want to design a sphere with 8 holes around one of its diameters. How do I do it? How do I draw anything on a sphere in Papervision?

+1  A: 

Hi.

Depends on how you want the holes to look like. You could just make a wholes with holes in it in any 3d editor. Blender and wings 3d , sketchup are free and can export in papervision supported formats.

If you want to draw on a sphere, it means you want to create and apply a texture. You might want to try using a BumpMap for a bit of realism, but for npw, just a applying a material is a good start.

The simplest way is to apply a Bitmap or MovieMaterial. A Bitmap Material is just a Bitmap, as the name implies and a MovieMaterial is a material made from a MovieClip. There are 3 flavours of Bitmap materials as far as I know:

BitmapMaterial - you pass a BitmapData instance in it's constructor BitmapFileMaterial - you pass the path to a an external image file BitmapAssetMaterial - you pass the linkage name of a bitmap from the library.

MovieMaterial has 2 version: simple MovieMaterial, you pass in a reference to a DisplayObject in it's constructor and MovieAssetMaterial. You pass the Linkage Class set for a MovieClip in the Library. There is also a MovieCacheMaterial, but I don't think you'll need it for this.

so here is a basic example on how you add a texture to a sphere, assuming your scene is called scene:

//assuming BMP8holes is a linkage for a Bitmap in the library
var ballBitmapMaterial:BitmapAssetMaterial = new BitmapAssetMaterial("BMP8holes");
//assuming Movie8holes is a linkage a MovieClip in the library
var ballMovieMaterial:MovieAssetMaterial = new MovieAssetMaterial("Movie8holes");

var ball:Sphere = new Sphere(ballBitmapMaterial);
scene.addChild(ball);

Sphere reference ( well...pv3d docs anyway) here: http://papervision3d.googlecode.com/svn/trunk/as3/trunk/docs/org/papervision3d/objects/primitives/Sphere.html

Hope this helps.

George Profenza