Papervision3D drawing demo

Posted on May 9th, 2008 by John Grden.
Categories: Flash, 3D, teaching, Papervision3D, training, ActionScript.

2 classes in a row now, I've done this same demo live in front of everyone :) Sooooo sensing a trend here, and after someone asked if I'd post it, I'm putting out out here. It's a very simple demo, but the exercise in class was to demonstrate what you get back with the InteractiveScene3DEvent object. You literally get back x and y properties that represent where your cursor is over the 3D object in your scene.

So, we took those values from an OBJECT_MOVE event that the ISM dispatches and use it to draw circles on the MovieClip used for the material - and there you go, simple as that ;)

Here's the code and you can download it here:

Actionscript:
  1. import org.papervision3d.scenes.Scene3D;
  2. import org.papervision3d.cameras.FreeCamera3D;
  3. import org.papervision3d.objects.primitives.Plane;
  4. import org.papervision3d.objects.DisplayObject3D;
  5. import org.papervision3d.materials.MovieMaterial;
  6. import org.papervision3d.view.Viewport3D;
  7. import org.papervision3d.render.BasicRenderEngine;
  8. import org.papervision3d.events.InteractiveScene3DEvent;
  9. import org.papervision3d.core.utils.InteractiveSceneManager;
  10. import flash.filters.DropShadowFilter;
  11. import flash.display.StageAlign;
  12. import flash.display.StageScaleMode;
  13.  
  14. stage.align = StageAlign.TOP_LEFT;
  15. stage.scaleMode = StageScaleMode.NO_SCALE;
  16.  
  17. var viewport:Viewport3D = new Viewport3D(0, 0, true, true);
  18. addChild(viewport);
  19.  
  20. var renderer:BasicRenderEngine = new BasicRenderEngine();
  21.  
  22. var scene3d:Scene3D = new Scene3D();
  23. var camera:FreeCamera3D = new FreeCamera3D();
  24. camera.focus = 1100;
  25. camera.zoom = 1;
  26.  
  27. // create material and object
  28. var mat:MovieMaterial = new MovieMaterial(material, false, true);
  29. mat.oneSide = false;
  30. mat.interactive = true;
  31.  
  32. var sp:Sprite = new Sprite();// add drawing layer
  33. sp.scrollRect = material.getBounds(material); // this keeps you from drawing off the edges and messing up the mapping
  34. sp.filters = [new DropShadowFilter(4, 45, 0x111111)];
  35. material.addChild(sp);
  36.  
  37. var plane:Plane = new Plane(mat, 500, 500, 4, 4);
  38. plane.moveRight(200);
  39. plane.yaw(60);
  40.  
  41. plane.addEventListener(InteractiveScene3DEvent.OBJECT_MOVE, handleMouseMove);
  42.  
  43. function handleMouseMove(e:InteractiveScene3DEvent):void
  44. {
  45.     if( !InteractiveSceneManager.MOUSE_IS_DOWN ) return;
  46.     var g:Graphics = sp.graphics;
  47.     g.beginFill(0x333333);
  48.     g.drawCircle(e.x, e.y, 4);
  49.     g.endFill();
  50. }
  51.  
  52. scene3d.addChild(plane);
  53.  
  54. stage.addEventListener(Event.ENTER_FRAME, handleEnterFrame);
  55.  
  56. function handleEnterFrame(e:Event):void
  57. {   
  58.     camera.x = camera.y = camera.z = 0;
  59.     camera.yaw(.5);
  60.     camera.moveBackward(1500);
  61.     // render camera
  62.     renderer.renderScene(scene3d, camera, viewport);
  63. }

4 comments.

Skype crashes just after logging in

Posted on May 8th, 2008 by John Grden.
Categories: Flash.

I now cannot load Skype on my Mac book Pro. I get logged in, I see the friends list, then bam, it dies.

I've reinstalled different versions
deleted preferences and plist files
removed application I had installed (battlefield 2142) just prior to it not working, but that didn't help
logged in as a new user on MBP
logged into skype as different user
ran Skype.app from DMG
deleted all contacts from Addressbook and turned off the option to load from it
started iChat and opened video preview, then started skype - nope.

Anyone seen this before?

Here's the top of the crash log:

Process: Skype [22791]
Path: /Applications/Skype.app/Contents/MacOS/Skype
Identifier: com.skype.skype
Version: 2.6.0.151 (2.6.0.151)
Code Type: X86 (Native)
Parent Process: launchd [161]

Date/Time: 2008-05-08 11:56:20.452 -0500
OS Version: Mac OS X 10.5.2 (9C7010)
Report Version: 6

Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000004
Crashed Thread: 0

1 comment.