hey fabrice ... thank you sooo much. The getcolor information did
help. the problem was that my "red" in the picture was compressed from
#ff0000 to #fe0000. Dont know why but its okay ... now it works
great .... big big thanks :-*

On 9 Jul., 17:54, Fabrice3D <[email protected]> wrote:
> because uv's are 1 where in flash they'll be 0
> and one where you would expect a height value
>
> then, this is important make sure the color you test on IS the color you 
> think it is...
>
> make a test at a position on the map you know its say "yellow"
> check the reading value and the one you entered for the event.
> due to compression algo's if you use a bitmap color might change
>
> fix is to draw with vector movieclips, and draw this movieclip into bitmap 
> runtime.
>
> again, to test addchild your map above, and plot the readings and trace the 
> colors to see if correct
> the class as a special test call for this purpose --> doc
>
> Fabrice
>
> On Jul 9, 2010, at 4:46 PM, le_unam wrote:
>
> > okay ehm the x and z values seem to be correct. on startup it is 0, 0
> > when i move forward it counts ... -20 -40 -60 -80 -100 .... and so on.
> > but why should is use -z? whats the matter with the -? can u please
> > explain it to me?
> > what about the offset position of the map? where is the startpoint?
> > lower left corner = 0, 0 ?
>
> > On 9 Jul., 16:06, le_unam <[email protected]> wrote:
> >> hey thanks for your answer ... i will try this ... the scale ratio 1,1
> >> is because my plane is width:1000, height:1000 and my map is width:
> >> 1000, height:1000 too.
> >> maybe there is an offset problem or something like this.  thanks
>
> >> On 9 Jul., 15:10, Fabrice3D <[email protected]> wrote:
>
> >>> you have a scale ratio 1, 1 passed to class
>
> >>> trace your x and -z when you ask the "read"
> >>> they are probably exceeded the bounds of your map.
>
> >>> try attach on top of your scene this map or a duplicate, and setPixel at 
> >>> this coords...
> >>> i bet you are way off.
>
> >>> Fabrice
>
> >>> On Jul 9, 2010, at 2:00 PM, le_unam wrote:
>
> >>>> hey fabrice okay now there are no more errors ... it was an syntax
> >>>> problem. But the collisionmap isnt still working. nothing happens when
> >>>>walkingover the "red" area = (
> >>>> where can be the mistake? the y position of the cube doesnt matter
> >>>> right?
> >>>> what about the offset position of the map? ist it necessary to set it?
>
> >>>> best regards
>
> >>>> On 9 Jul., 11:33, le_unam <[email protected]> wrote:
> >>>>> hey fabrice thank you ... well i tried to make an easy example for
> >>>>> collision map. i created a cube, which is followed by the camera and a
> >>>>> plane with the texture of the collisionmap for easy understanding. but
> >>>>> i still get an error ... maybe you can check my code for syntax
> >>>>> problems. it would be very nice.
>
> >>>>> code --------------------------------------------------------------
>
> >>>>> package
> >>>>> {
> >>>>>         import away3d.cameras.SpringCam;
> >>>>>         import away3d.containers.*;
> >>>>>         import away3d.core.base.Object3D;
> >>>>>         import away3d.core.clip.FrustumClipping;
> >>>>>         import away3d.core.math.Number3D;
> >>>>>         import away3d.core.render.Renderer;
> >>>>>         import away3d.core.utils.Cast;
> >>>>>         import away3d.extrusions.CollisionMap;
> >>>>>         import away3d.materials.*;
> >>>>>         import away3d.primitives.*;
>
> >>>>>         import flash.display.DisplayObjectContainer;
> >>>>>         import flash.display.BitmapData;
> >>>>>         import flash.display.MovieClip;
> >>>>>         import flash.events.Event;
> >>>>>         import flash.events.KeyboardEvent;
> >>>>>         import flash.ui.Keyboard;
>
> >>>>>         [SWF(width="800", height="600", frameRate="30", quality="LOW",
> >>>>> backgroundColor="0xFFFFFF")]
> >>>>>         public class colltest extends MovieClip
> >>>>>         {
> >>>>>                         private var myScene:Scene3D;
> >>>>>                         private var myCamera:SpringCam;
> >>>>>                         private var myClipping:FrustumClipping;
> >>>>>                         private var myCube:Cube;
> >>>>>                         private var myView:View3D;
> >>>>>                         private var myCollision:BitmapData;
> >>>>>                         private var myCollisonmap:CollisionMap;
>
> >>>>>                         private var keyIsDown:Boolean = false;
> >>>>>                         private var keyHandler:Number = 0;
>
> >>>>>                         private var myBoden:Plane;
>
> >>>>>                         public function colltest()
> >>>>>                         {
> >>>>>                                         initEngine();
> >>>>>                                         initObjects();
> >>>>>                                         initEventListeners();
> >>>>>                         }
>
> >>>>>                         public function initEngine()
> >>>>>                         {
> >>>>>                                         myScene = new Scene3D;
> >>>>>                                         myCamera = new SpringCam;
> >>>>>                                         myClipping = new 
> >>>>> FrustumClipping;
>
> >>>>>                                         myView = new View3D( { 
> >>>>> scene:myScene, camera:myCamera,
> >>>>> clipping:myClipping, renderer:Renderer.CORRECT_Z_ORDER,
> >>>>> x:stage.stageWidth / 2, y:stage.stageHeight / 2 } );
> >>>>>                                         addChild(myView);
>
> >>>>>                                         myScene.addChild(myCamera);
>
> >>>>>                                         myCube = new Cube( { width:1, 
> >>>>> height:1, depth:1 } );
> >>>>>                                         myScene.addChild(myCube);
>
> >>>>>                                         myCamera.zoom = 10;
> >>>>>                                         myCamera.focus = 100;
> >>>>>                                         myCamera.mass = 10;
> >>>>>                                         myCamera.damping = 10;
> >>>>>                                         myCamera.stiffness = 10;
> >>>>>                                         myCamera.target = myCube;
> >>>>>                                         
> >>>>> myCamera.lookAt(myCube.position);
> >>>>>                     myCamera.lookOffset = new Number3D(0, 0, 100);
> >>>>>                     myCamera.positionOffset = new Number3D(0, 0, 50);
>
> >>>>>                                         myCollision = new 
> >>>>> BitmapData(Cast.bitmap(cmap));
> >>>>>                                         myCollisionmap = new 
> >>>>> CollisionMap(myCollision, 1, 1);
> >>>>>                                         
> >>>>> myCollisionmap.setColorEvent(0xFF0000, "red", onCollision);
>
> >>>>>                                         myView.render();
> >>>>>                         }
>
> >>>>>                         public function initObjects()
> >>>>>                         {
> >>>>>                                         var myMaterial:BitmapMaterial = 
> >>>>> new
> >>>>> BitmapMaterial(Cast.bitmap(cmap));
> >>>>>                                         myBoden = new Plane ( { 
> >>>>> material:myMaterial, width:1000, height:
> >>>>> 1000, y: -stage.stageWidth / 2 } );
> >>>>>                                         myScene.addChild(myBoden);
> >>>>>                         }
>
> >>>>>                         public function onCollision()
> >>>>>                         {
> >>>>>                                         trace("berührt");
> >>>>>                         }
>
> >>>>>                         public function initEventListeners()
> >>>>>                         {
> >>>>>                                         
> >>>>> addEventListener(Event.ENTER_FRAME, initEnterFrame);
> >>>>>                                         
> >>>>> stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDown);
> >>>>>                                         
> >>>>> stage.addEventListener(KeyboardEvent.KEY_UP, keyUp);
> >>>>>                         }
>
> >>>>>                         public function keyDown(e:KeyboardEvent):void
> >>>>>                         {
> >>>>>                                         keyIsDown = true;
> >>>>>                                         keyHandler = e.keyCode;
> >>>>>                         }
>
> >>>>>                         public function keyUp(e:KeyboardEvent):void
> >>>>>                         {
> >>>>>                                         keyIsDown = false;
> >>>>>                         }
>
> >>>>>                         public function initEnterFrame(e:Event):void
> >>>>>                         {
> >>>>>                                         if (keyIsDown)
> >>>>>                                         {
> >>>>>                                                         
> >>>>> switch(keyHandler)
> >>>>>                                                         {
> >>>>>                                                                         
> >>>>> case 65:                        myCube.moveLeft(20); break;
> >>>>>                                                                         
> >>>>> case 68:                        myCube.moveRight(20); break;
> >>>>>                                                                         
> >>>>> case 87:                        myCube.moveForward(20); break;
> >>>>>                                                                         
> >>>>> case 83:                        myCube.moveBackward(20); break;
> >>>>>                                                         }
> >>>>>                                         }
>
> >>>>>                                         myCollisionmap.read(myCube.x, 
> >>>>> -myCube.z);
>
> >>>>>                                         myCamera.view;
> >>>>>                                         myView.render();
> >>>>>                         }
> >>>>>         }
>
> >>>>> }
>
> >>>>> codeend -------------------------------------------------------
>
> >>>>> maybe i forgot something to import? i dont know .... do you see any
> >>>>> errors?
> >>>>> if i comment the lines of collisonmap out ... i can walk over the
> >>>>> plane with the collisionmap
>
> >> ...
>
> >> Erfahren Sie mehr »

Reply via email to