Archive for January 5th, 2009
Looking around the inside of a Sphere
package { import flash.events.Event; import flash.ui.Mouse; import org.papervision3d.core.proto.MaterialObject3D; import org.papervision3d.core.utils.Mouse3D; import org.papervision3d.materials.ColorMaterial; import org.papervision3d.materials.WireframeMaterial; import org.papervision3d.materials.special.CompositeMaterial; import org.papervision3d.objects.DisplayObject3D; import org.papervision3d.objects.primitives.Plane; import org.papervision3d.objects.primitives.Sphere; import org.papervision3d.view.BasicView; import org.papervision3d.view.layer.ViewportLayer; import org.papervision3d.view.layer.util.ViewportLayerSortMode; [SWF(width="640", height="480", backgroundColor="#000000", frameRate="60")] public class LookingAroundTheInsideOfASphere extends BasicView { private var lookAtMe:DisplayObject3D; private var sphere:Sphere; private var mouse3D:Mouse3D; private var plane:Plane; public function LookingAroundTheInsideOfASphere() { viewport.interactive = true; mouse3D = viewport.interactiveSceneManager.mouse3D; Mouse3D.enabled = true; lookAtMe = new DisplayObject3D(); var wireframeMaterial:WireframeMaterial = new WireframeMaterial(0x444444); var colorMaterial:ColorMaterial = new ColorMaterial(0xdddddd); var sphereMaterial:CompositeMaterial = new CompositeMaterial(); sphereMaterial.addMaterial(wireframeMaterial); sphereMaterial.addMaterial(colorMaterial); sphereMaterial.interactive = true; sphereMaterial.doubleSided = true; sphere = new Sphere(sphereMaterial, 500, 24, 18); var planeMaterial:MaterialObject3D = new ColorMaterial(0xcc0000); planeMaterial.doubleSided = true; plane = new Plane(planeMaterial, 50, 50); var viewportLayer:ViewportLayer = new ViewportLayer(viewport, plane); viewportLayer.layerIndex = 1; viewport.containerSprite.sortMode = ViewportLayerSortMode.INDEX_SORT; viewport.containerSprite.addLayer(viewportLayer); scene.addChild(plane); camera.z = -300; camera.target = lookAtMe; scene.addChild(sphere); startRendering(); Mouse.hide(); } override protected function onRenderTick(event:Event=null):void { lookAtMe.x += (mouse3D.x - lookAtMe.x) * .03; lookAtMe.y += (mouse3D.y - lookAtMe.y) * .03; plane.copyTransform(mouse3D); super.onRenderTick(event); } } }
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
- Xdragosy on Ribbons
- As on What is BasicView?
- Godie_dito on Dynamic Text on a Plane
- Angel Kaido on Following line
- bambii7 on faq
- Felipe on TweenMax – Tweening a timeline (Advanced Tweening)
- Ocatarinabelachichix on about
- Rajiv on faq
- Rajiv on 3ds max texture baking for Papervision3D
- Anupam Biswas on Maya Texture Baking
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


