Plane with two different sides
Create two planes, rotate the back plane 180 degrees, then group them together in a parent DisplayObject3D.
package { import flash.display.Bitmap; import flash.display.MovieClip; import flash.events.Event; import flash.text.TextField; import flash.text.TextFieldAutoSize; import flash.text.TextFormat; import org.papervision3d.events.InteractiveScene3DEvent; import org.papervision3d.materials.BitmapMaterial; import org.papervision3d.materials.MovieMaterial; import org.papervision3d.objects.DisplayObject3D; import org.papervision3d.objects.primitives.Plane; import org.papervision3d.view.BasicView; [SWF(width="640", height="480", frameRate="60", backgroundColor="#000000")] public class TwoSidedPlane extends BasicView { [Embed(source="assets/fish.jpg")] public var fishAsset:Class; private var planeGroup:DisplayObject3D; private var planeFront:Plane; private var planeBack:Plane; private var fishMaterial:BitmapMaterial; private var movieMaterial:MovieMaterial; private var textField:TextField; public function TwoSidedPlane() { viewport.interactive = true; camera.zoom = 100; //this will hold both your planes in a group planeGroup = new DisplayObject3D(); //standard way to grab bitmap from embedded image var fishBitmap:Bitmap = new fishAsset() as Bitmap; fishMaterial = new BitmapMaterial(fishBitmap.bitmapData, true); planeFront = new Plane(fishMaterial); //a simple movieclip to hold our text field var movieClip:MovieClip = new MovieClip(); movieClip.graphics.lineStyle(5,0xcc0000); movieClip.graphics.drawRect(0,0,300,270); //text field and formatting junk textField = new TextField(); var textFormat:TextFormat = new TextFormat("Arial"); textFormat.size = 34; textFormat.color = 0xcc0000; textField.autoSize = TextFieldAutoSize.LEFT; textField.defaultTextFormat = textFormat; textField.text = "default"; movieClip.addChild(textField); movieMaterial = new MovieMaterial(movieClip, true, true, true); //smooth out the text movieMaterial.smooth = true; movieMaterial.interactive = true; planeBack = new Plane(movieMaterial); planeBack.addEventListener(InteractiveScene3DEvent.OBJECT_OVER, objectOverHandler); planeBack.addEventListener(InteractiveScene3DEvent.OBJECT_OUT, objectOutHandler); planeGroup.addChild(planeFront); /*rotate the plane in the "back" so it looks like the back side of the front*/ planeBack.rotationY = 180; planeGroup.addChild(planeBack); scene.addChild(planeGroup); startRendering(); } private function objectOverHandler(e:InteractiveScene3DEvent):void { textField.text = "That tickles!"; viewport.buttonMode = true; } private function objectOutHandler(e:InteractiveScene3DEvent):void { textField.text = "I'm lonely!"; viewport.buttonMode = false; } override protected function onRenderTick(event:Event=null):void { planeGroup.yaw(1); renderer.renderScene(scene, camera, viewport); } } }
-
mike
-
I like to play
-
baixiaozhe
Search
Recommended Books
Speaking at FITC Toronto
Recent Posts
- Moving to johnlindquist.com
- AsyncCommand with Robotlegs, Signals, Flight, MinimalComps
- Search Widget – Robotlegs, Signals, Flight, Minimal Comps, Yahoo Astra
- FDT Super Awesome March Deal
- haXe Tutorial
- AS3 Signals Tutorial
- Preferred Video Tutorial Resolution?
- TweenMax – Tweening a timeline (Advanced Tweening)
- Robotlegs + Flight + Union Platform
- Back in the saddle
- Eclipse Theme Designer Preview
- RobotLegs Hello World Video Tutorial
- 10 Things Every Senior Flash Developer Should Know
- Efflex – 3D Effects for Flex
- MorphController – Mighty Morphing Papervision3D
Recent Comments
- list of lpn courses on SpringCamera3D and Driving a Car
- rn to bsn in montgomery al on archive
- PowerPoint Recovery on Eclipse Theme Designer Preview
- cheat mw3 on Test if a plane is within the view of the camera (aka testing if culled)
- Goa Hotels on Looking around the inside of a Sphere
- cheat gratuit on Looking around the inside of a Sphere
- Application Development on Robotlegs + Flight + Union Platform
- nexium on Moving Faces
- buy nexium on Holy Sphere
- buy aldara online on Tweening a “moveForward()” behavior
Categories
Archives
Preferred Video Tutorial Resolution
- 1024x768 (53%, 85 Votes)
- 1280x1024 (15%, 24 Votes)
- 1920x1080 (15%, 24 Votes)
- 800x600 (13%, 20 Votes)
- 480x320 (4%, 6 Votes)
- 640x480 (0%, 2 Votes)
Total Voters: 160


