[Papervision3D] InteractiveSceneManager on a Cube

John Grden neoriley at gmail.com
Tue Nov 27 10:30:04 PST 2007


You should note that SimpleButton objects don't work with VirtualMouse (IE:
when you use Flash Ide, you create a symbol and it's type is "button" -
that's a SimpleButton object).  The normal Button class/object works just
fine

I've just committed a fix for ISM and VirtualMouse - please give that a
whirl

On Nov 27, 2007 12:23 PM, juanit0 <juan at sonikweb.com> wrote:

>
> Ok, I updated my code to use the phunky branch and it works. Only thing is
> I
> can't get button mode to apply on buttons located in the texture but they
> do
> work correctly. If I use
> scene.interactiveSceneManager.addEventListener(
> InteractiveScene3DEvent.OBJECT_CLICK,
> handleClick); I can get the button to be active on the whole cube but I
> need
> more control.
>
> In this example I have some functions triggered in the button class
> itself,
> everything works without setting any listeners, witch is great.
>
> Here's my createCube function:
>
>        private function createCube()
>        {
>                // Attributes
>                var cubeWidth :Number = 1000;
>                var cubeHeight :Number = 565.2;
>                var quality :Number = 6;
>
>                //Materials
>                front = new MovieAssetMaterial("Front", true, true);
>                //front.addEventListener(
> InteractiveScene3DEvent.OBJECT_CLICK,
> handleClick);
>                //front.movie["btn1"].buttonMode = true;
>                back = new MovieAssetMaterial("Back", true, true);
>                left = new MovieAssetMaterial("Left", true, true);
>                right = new MovieAssetMaterial("Right", true, true);
>                top = new MovieAssetMaterial("Top", true, true);
>                bottom = new MovieAssetMaterial("Bottom", true, true);
>                front.interactive = back.interactive = left.interactive =
> right.interactive = true;
>
>                //
>                front.name = "front";
>                back.name = "back";
>        right.name = "right";
>                left.name = "left";
>                top.name = "top";
>                bottom.name = "bottom";
>
>                // Materials
>                var materials:MaterialsList = new MaterialsList(
>                {
>                        //all:
>                        front:  front,
>                        back:   back,
>                        right:  right,
>                        left:  left,
>                        top:   top,
>                        bottom: bottom
>                } );
>
>                // Create the cube.
>                cube = new Cube( materials, cubeWidth, cubeWidth,
> cubeHeight, quality,
> quality, quality );
>
>                scene.addChild( cube, "Cube" );
>                cube.rotationY = xRot;
>                cube.rotationX = yRot;
>                cube.scaleX = 0.3;
>                cube.scaleY = 0.3;
>                cube.scaleZ = 0.3;
>                showCube();
>
>                //
>
> //scene.interactiveSceneManager.addEventListener(
> InteractiveScene3DEvent.OBJECT_CLICK,
> handleClick);
>        }
>
>
> axiomflash wrote:
> >
> > Hey there, I'm not sure exactly what v1.7 is, but I know that in the
> trunk
> > there are issues with using interactive materials on a cube.  I had a
> > similar problem and had to upgrade to Phunky, you may want to try that.
> >
> >
> > On Nov 26, 2007 1:31 PM, juanit0 <juan at sonikweb.com> wrote:
> >
> >>
> >> Hi, I've been working for a few days to get a Cube working with
> >> interactive
> >> faces and movieclips streaming FLV's, I based my work on the Cube
> example
> >> file.
> >>
> >> Right now I'm able to trace the clicked face with
> >> "trace(e.face3d.material.name);" but I can't find how to stop/play the
> >> movieclip or how to interact with buttons the elements it contains. Any
> >> help
> >> would be appreciated, I think I read all the threads around on the
> >> subject
> >> but I'm stucked, I'm using the 1.7 version.
> >>
> >> Thanks!
> >>
> >> // ___________________________
> >>
> >> package com.components
> >> {
> >> import flash.display.*;
> >> import flash.events.*;
> >>
> >> // Import Papervision3D
> >> import org.papervision3d.events.*;
> >> import org.papervision3d.scenes.*;
> >> import org.papervision3d.cameras.*;
> >> import org.papervision3d.objects.*;
> >> import org.papervision3d.materials.*;
> >> import org.papervision3d.utils.*;
> >> import org.papervision3d.objects.*;
> >>
> >> public class BellCube extends Sprite
> >> {
> >>        //
> >> ___________________________________________________________________
> >> Static
> >>
> >>        static public var SCREEN_WIDTH  :int = 1024;
> >>        static public var SCREEN_HEIGHT :int = 768;
> >>
> >>        //
> >> ___________________________________________________________________ 3D
> >> vars
> >>
> >>        private var container :Sprite;
> >>        private var scene     :InteractiveScene3D;
> >>        private var camera    :Camera3D;
> >>        private var cube      :Cube;
> >>        private var xRot      :Number;
> >>        private var yRot      :Number;
> >>        private var _ism          :InteractiveSceneManager;
> >>
> >>        //
> >> ___________________________________________________________________
> main
> >>
> >>        public function BellCube()
> >>        {
> >>                init3D();
> >>                createCube();
> >>                this.addEventListener( Event.ENTER_FRAME, loop );
> >>        }
> >>
> >>
> >>        //
> >> ___________________________________________________________________
> >> Init3D
> >>
> >>        private function init3D():void
> >>        {
> >>                // Create container sprite and center it in the stage
> >>                container = new InteractiveSprite();
> >>                addChild( container );
> >>                container.x = SCREEN_WIDTH  /2;
> >>                container.y = SCREEN_HEIGHT /2;
> >>                container.name = "_container";
> >>
> >>                // Create scene
> >>                scene = new InteractiveScene3D( container );
> >>                _ism = scene.interactiveSceneManager;
> >>                _ism.faceLevelMode = true;
> >>                _ism.buttonMode = true;
> >>
> >>                // Create camera
> >>                camera = new Camera3D();
> >>                camera.zoom = 1;
> >>                camera.focus = 1650;
> >>                camera.z = -1500;
> >>
> >>                //initial rotation
> >>                xRot = 180;
> >>                yRot = 0;
> >>        }
> >>
> >>
> >>        //
> >> ___________________________________________________________________
> >> Create Cube
> >>
> >>        private function createCube()
> >>        {
> >>                // Attributes
> >>                var cubeWidth :Number = 1000;
> >>                var cubeHeight :Number = 565.2;
> >>                var quality :Number = 6;
> >>
> >>                var front:InteractiveMovieAssetMaterial = new
> >> InteractiveMovieAssetMaterial("Front", true, true);
> >>                var back:InteractiveMovieAssetMaterial = new
> >> InteractiveMovieAssetMaterial("Back", true, true);
> >>                var left:InteractiveMovieAssetMaterial = new
> >> InteractiveMovieAssetMaterial("Left", true, true);
> >>                var right:InteractiveMovieAssetMaterial = new
> >> InteractiveMovieAssetMaterial("Right", true, true);
> >>                var top:InteractiveMovieAssetMaterial = new
> >> InteractiveMovieAssetMaterial("Top", true, true);
> >>                var bottom:InteractiveMovieAssetMaterial = new
> >> InteractiveMovieAssetMaterial("Bottom", true, true);
> >>
> >>                // Materials
> >>                var materials:MaterialsList = new MaterialsList(
> >>                {
> >>                        front:  front,
> >>                        back:   back,
> >>                        right:  right,
> >>                        left:  left,
> >>                        top:   top,
> >>                        bottom: bottom
> >>                } );
> >>
> >>                front.name = "front";
> >>                back.name = "back";
> >>        right.name = "right";
> >>                left.name = "left";
> >>                top.name = "top";
> >>                bottom.name = "bottom";
> >>
> >>                // Create the cube: materials, width, depth, height
> >>                cube = new Cube( materials, cubeWidth, cubeWidth,
> >> cubeHeight, quality);
> >>
> >>                //add cube to the scene and set initial rotation angle
> >>                scene.addChild( cube, "Cube" );
> >>                cube.rotationY = xRot;
> >>                cube.rotationX = yRot;
> >>
> >>                //ISM
> >>
> >> scene.interactiveSceneManager.addEventListener(
> >> InteractiveScene3DEvent.OBJECT_CLICK,
> >> handleClick);
> >>        }
> >>
> >>
> >>        //
> >> ___________________________________________________________________
> Loop
> >>
> >>        private function loop(event:Event):void
> >>        {
> >>                update3D();
> >>        }
> >>
> >>        protected function handleClick(e:InteractiveScene3DEvent):void
> >>        {
> >>                trace(e.face3d.material.name);
> >>        }
> >>
> >>
> >>        private function update3D():void
> >>        {
> >>                // Render
> >>                scene.renderCamera( this.camera );
> >>        }
> >> }
> >> }
> >>
> >> // ___________________________
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/InteractiveSceneManager-on-a-Cube-tf4877784.html#a13958174
> >> Sent from the Papervision3D mailing list archive at Nabble.com.
> >>
> >>
> >> _______________________________________________
> >> Papervision3D mailing list
> >> Papervision3D at osflash.org
> >> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> >>
> >
> > _______________________________________________
> > Papervision3D mailing list
> > Papervision3D at osflash.org
> > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/InteractiveSceneManager-on-a-Cube-tf4877784.html#a13976691
> Sent from the Papervision3D mailing list archive at Nabble.com.
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>



-- 
[  JPG  ]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20071127/204ae85a/attachment-0001.html 


More information about the Papervision3D mailing list