thanks for that, but i've decided to use BSP instead.. although now
i'm having the same problem with collision detection in BSP as well :
((
see this post 
http://groups.google.com/group/away3d-dev/browse_thread/thread/f12e39db93ca591e

On Aug 25, 12:08 pm, Fabrice3D <[email protected]> wrote:
> Make sure its 00FF00, again regarding compression on bitmaps, green is not 
> allways "pure" green at runtime.
> To be sure you are reading at expected location on map, addChild in a bitmap 
> this map and plot (setPixel()) the position you check on.
> This would have pointed you out earlyer that you were reading on the wrong 
> plane. X/Y instead of X/Z.
>
> See it bits like google maps. its the representation of your scene from above.
>
> Fabrice
>
> On Aug 25, 2010, at 9:53 AM, le_unam wrote:
>
> > hey i think you have to read the collision map like this:
>
> > myCollisionmap.read(myCube.x, -myCube.z);
>
> > in addition to this you can trace the getcolor ... but the read is
> > neccassary maybe.
>
> > try it
>
> > On 25 Aug., 09:42, bebensiganteng <[email protected]> wrote:
> >> hi le_unam, if you can help me please please help me, greatly
> >> appreciated, have been pulling my hair for hours :)))
>
> >> i just saw your post but couldnt understand what was going on..
>
> >> i'm using the bitmap that was used inside Advanced_FrustumHotelRoom
> >> sample, if you see the bitmap (from the sample) it has a red area that
> >> was surrounded by green area, my questions are
>
> >> - i managed to detect the red color by using this method
> >> _collisionMap.getColorAt(_view.camera.x, _view.camera.y) but no matter
> >> how far i went it never detected the green area
> >> - how to match the bitmap with the model later on? can we create some
> >> sort of visual guidance because right now i feel like i'm measuring
> >> inside a cave
>
> >> below is my code,
>
> >> import away3d.extrusions.CollisionMap;
> >>         import flash.display.BitmapData;
> >>         import flash.display.Stage;
> >>         import flash.events.Event;
> >>         import flash.events.MouseEvent;
> >>         import flash.geom.Rectangle;
>
> >>         import com.gaiaframework.core.GaiaMain;
>
> >>         import com.albakara.views.GameView;
>
> >>         import away3d.cameras.*;
> >>         import away3d.cameras.lenses.*;
> >>         import away3d.containers.*;
> >>         import away3d.core.base.*;
> >>         import away3d.core.clip.*;
> >>         import away3d.core.draw.*;
> >>         import away3d.core.math.*;
> >>         import away3d.core.render.*;
> >>         import away3d.core.utils.*;
> >>         import away3d.events.*;
> >>         import away3d.loaders.*;
> >>         import away3d.loaders.data.*;
> >>         import away3d.materials.*;
> >>         import away3d.primitives.*;
>
> >>         public class MainView extends GameView
> >>         {
> >>                 private static const ACCELERATION:Number = 70;
> >>                 private static const MOVE_SPEED:Number = 250;
>
> >>                 private var _view:View3D;
> >>                 private var _lastMouseX:Number;
> >>                 private var _lastMouseY:Number;
> >>                 private var _lastRotX:Number;
> >>                 private var _lastRotY:Number;
> >>                 private var _rotX:Number;
> >>                 private var _rotY:Number;
> >>                 private var _dragX:Number = 0;
> >>                 private var _dragY:Number = 0;
>
> >>                 private var _zDir:Number = 10;
> >>                 private var _speedMultiplier:Number = .4;
>
> >>                 public function MainView()
> >>                 {
> >>                         initAway3D();
> >>                         initCollisionBitmap();
> >>                 }
>
> >>                 private function initAway3D():void
> >>                 {
> >>                         _view = new View3D( { x: getStage().stageWidth * 
> >> .5, y:
> >> getStage().stageHeight * .5, clipping: new NearfieldClipping() } );
> >>                         _view.camera.lens = new PerspectiveLens();
> >>                         _view.camera.zoom = 10;
> >>                         _view.camera.rotationX = 0;
> >>                         _view.camera.rotationY = 0;
> >>                         _view.camera.rotationZ = 0;
>
> >>                         getLastPosition();
>
> >>                         var sphere:Object3D = new 
> >> Sphere({material:"blue#cyan", radius:250,
> >> segmentsW:12, segmentsH:9, y:50, x:10, z:200});
> >>                         // add the sphere to the scene
> >>                         _view.scene.addChild(sphere);
>
> >>                         addChild(_view);
> >>                         addEventListener(Event.ENTER_FRAME, onEnterFrame, 
> >> false, 0, true);
>
> >>                 }
>
> >>                 private function onEnterFrame(e:Event):void
> >>                 {
>
> >>                         _dragX          = mouseX;
> >>                         _dragY          = mouseY;
>
> >>                         var maxSpeed:Number = MOVE_SPEED * 
> >> _speedMultiplier;
>
> >>                         _rotX = _lastMouseX - (mouseY - _lastRotY)*0.7;
> >>                         _rotY = _lastMouseY + (mouseX - _lastRotX)*0.7;
>
> >>                         if(_rotX > 90) _rotX = 70;
> >>                         if(_rotX < -90) _rotX = -70;
> >>                         _view.camera.rotationX += (_rotX - 
> >> _view.camera.rotationX)/50;
> >>                         _view.camera.rotationY += (_rotY - 
> >> _view.camera.rotationY) / 50;
>
> >>                         //trace('_lastMouseX:', _lastMouseX, '_lastRotY:', 
> >> _lastRotY,
> >> 'mouseY:', mouseY);
>
> >>                         _view.camera.moveForward(_zDir);
>
> >> // in here i got the read but i couldnt detect the green
> >>                         trace(_collisionMap.getColorAt(_view.camera.x, 
> >> _view.camera.y));
>
> >>                         _view.render();
>
> >>                         getLastPosition();
> >>                 }
>
> >>                 private function getLastPosition():void
> >>                 {
> >>                         _lastMouseX = _view.camera.rotationX;
> >>                         _lastMouseY = _view.camera.rotationY;
> >>                         _lastRotX       = mouseX;
> >>                         _lastRotY       = mouseY;
> >>                 }
>
> >> // COLLISION BITMAP
> >> //___________________________________________________________
>
> >>                 private var _collisionBitmap:BitmapData;
> >>                 private var _collisionMap:CollisionMap;
>
> >>                 private function initCollisionBitmap():void
> >>                 {
> >>                         _collisionBitmap        = 
> >> Cast.bitmap(CollisionBitmap);
> >>                         _collisionMap           = new 
> >> CollisionMap(_collisionBitmap, .2, .2);
> >>                         _collisionMap.setColorEvent(0x00FF00, "green", 
> >> onCollision);
>
> >>                 }
>
> >>                 private function onCollision(e:*):void
> >>                 {
> >>                         trace("collision");
> >>                 }
>
> >> // HELPER
> >> //___________________________________________________________
>
> >>                 private function getStage():Stage
> >>                 {
> >>                         try
> >>                         {
> >>                                 return GaiaMain.instance.stage;
> >>                         }
> >>                         catch (e:Error)
> >>                         {
> >>                                 //
> >>                         }
>
> >>                         return stage;
> >>                 }
> >>         }
>
> >> }
>
> >> On Aug 25, 10:13 am, le_unam <[email protected]> wrote:
>
> >>> maybe when you tell some details of what isnt running i can help you

Reply via email to