Archive

Posts Tagged ‘Papervision3d’

Actionscript 3 – Papervision3D Interactive Collada, DAE objects.

March 30th, 2009 miguelMoraleda 5 comments

If you dont know what is a collada object. The Collada files, are 3d models exported to xml format. With Papervision3D we can create the models into our flash. If you need more info you could read the next link

Collada Files in wikipedia

If you need interactive collada, must meet the following requirements:

  • Thw viewport must be interactive…. viewport.interactive = true.
  • All materials of the DAE object must be interactive also.
  • You need to add a listener for the InteractiveScene3DEvent that you want into each child of your collada.

Here a example how to set all materials to interactive :

1
2
3
4
5
6
7
private function setInteractiveMaterials(targetObject:DisplayObject3D, value:Boolean):void
{
	for each(var mat:MaterialObject3D in _targetObject.materials.materialsByName)
	{
		mat.interactive = value;
	}
}

How to put a eventListener into each child.

1
2
3
4
5
6
7
8
private function addEventListeners(displayObject:DisplayObject3D, eventType:String, listener:Function):void
{
	displayObject.addEventListener(eventType, listener);
 
	for each(var child:DisplayObject3D in displayObject.children) {
		addEventListeners(child, eventType, listener);
	}
}

The call of the last function will be this:

1
addEventListeners(_obj, InteractiveScene3DEvent.OBJECT_PRESS, daePressedHandler);

I’m not sure if this way is the better. If you have some idea or suggest please post your comments.

VIEW EXAMPLE
DOWNLOAD EXAMPLE FOR CS4
DOWNLOAD EXAMPLE FOR CS3



Categories: Papervision3d Tags:

Tutorial Papervision3D – Load Collada DAE example source

March 8th, 2009 miguelMoraleda 5 comments

collada

VIEW EXAMPLE

DOWNLOAD EXAMPLE

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package
{
	import flash.events.Event;
	import org.papervision3d.materials.utils.MaterialsList;
	import org.papervision3d.materials.WireframeMaterial;
	import org.papervision3d.objects.parsers.DAE;
	import org.papervision3d.objects.DisplayObject3D;
	import org.papervision3d.view.BasicView;
	import flash.display.Sprite;
 
	public class Main extends BasicView
	{
		private var _obj:DAE;
 
		public function Main()
		{
			super(0, 0, true);
 
			createObject();
 
			_camera.zoom = 1000 / _camera.focus + 1;
			var cameraTarget:DisplayObject3D = new DisplayObject3D();
			_camera.target = cameraTarget;
 
			startRendering();
		}
 
		private function createObject():void
		{
			_obj = new DAE(false, "objeto");
			_obj.load("soccer.DAE");
			scene.addChild(_obj);
		}
 
		override protected function onRenderTick(event:Event = null):void
		{
			_obj.roll(1);
 
			super.onRenderTick(event);
		}
	}
}



Categories: Flash, Papervision3d Tags:

Tutorial Papervision3D – Lights, light examples source code

March 7th, 2009 miguelMoraleda No comments

papervision3d-light

VIEW EXAMPLE
DOWNLOAD EXAMPLE
In papervision3D, we can find different types of materials that work with a light: FlatShadeMaterial, GouraudMaterial, PhongMaterial, and others. Here a sample illuminated material, the FlatShadeMaterial.


Categories: Papervision3d Tags:

flash actionscript 3 AS3DMod flag or cloth effect, changing objects

March 7th, 2009 admin No comments

bandera-chile-320x320 as3dmod-320x320

Here another important library, AS3DMod is a library for modifying 3D objects. Its main features are:
Current version 0.2. Features include:

VER EJEMPLO
DESCARGAR EJEMPLO

1. 7 modifiers as listed above
2. a framework for creating static and animated modifier stacks
3. 4 plug-ins for the most popular 3d engines: Pv3d, Away3d, Sandy3d and Alternativa3d
4. a simple demo for each engine

The project site is in http://code.google.com/p/as3dmod/ there you can download and find more examples.



Get Adobe Flash playerPlugin by wpburn.com wordpress themes