Hello everyone! and sorry for my english. I'm working in an educational game board. I have a problem because my character is seen through the walls in some areas.
Here, I have a video: http://away3d-dev.googlegroups.com/web/maze.avi?gda=jSeorToAAAD3NXDUDW5Slry6IVUku4OExC93VWMy3KH2VaOd0597yuFRVVXtXwVsR2O6z1LrPdv97daDQaep90o7AOpSKHW0&gsc=Z-skmgsAAABjdsjIMoqOOfcx-XEqLs01 And this is the code: public class Laberinto extends Sprite { private var shadow:Plane; public var sceneplane:Scene3D; private var plane:Object3D; private var group:ObjectContainer3D; public var scene:Scene3D; private var zero:Number3D; protected var view:View3D; private var pared:Array = new Array(); private var anchoPared:uint=50; private var pathanimator:PathAnimator; private var material:BitmapMaterial; private var md2:Md2; private var loader:LoaderCube; private var model:Mesh; private var momento:Number = 0; private var sign:Sprite; protected var viewplane:View3D; public function Laberinto() { zero=new Number3D(0,0,0); this.initSWFEnvironement(); this.prepareWorld(); this.showSignature(); return; }// end function private function refreshScreen(param1:Event):void { var event:* =param1; try { this.view.render(); this.view.scene.updateTime(); this.viewplane.render(); }// end try catch (e:Error) { trace("render error" + e.message); }// end catch return; }// end function private function showSignature():void { this.sign = new signature(); this.addChild(sign); this.sign.y=stage.stageHeight-sign.height; return; }// end function private function onResize(param1:Event):void { this.view.x=stage.stageWidth*0.5; this.view.y=stage.stageHeight*0.5; this.viewplane.x=stage.stageWidth*0.5; this.viewplane.y=stage.stageHeight*0.5; this.sign.y=stage.stageHeight-sign.height; return; }// end function private function generateFromLib (param1:String):BitmapData { var claseTemp:Class; var sprite:Sprite; var mapaBits:BitmapData; claseTemp=getDefinitionByName(param1) as Class; sprite=new claseTemp ; mapaBits=new BitmapData (sprite.width,sprite.height,true,16777215); mapaBits.draw(sprite, null, null, null, mapaBits.rect, true); return mapaBits; }// end function private function initSWFEnvironement():void { stage.align=StageAlign.TOP_LEFT; stage.scaleMode=StageScaleMode.NO_SCALE; stage.showDefaultContextMenu=true; stage.stageFocusRect=false; stage.quality="medium"; return; }// end function private function imageFromLib (param1:String):BitmapData { var claseTemp:Class; claseTemp=getDefinitionByName(param1) as Class; return new claseTemp(claseTemp.width, claseTemp.height); }// end function private function prepareWorld():void { var puntosPared:Array = new Array (); var punstosCamino:Array = new Array (); var suelo:IMaterial; var paredRight:IMaterial; var paredLeft:IMaterial; var paredFront:IMaterial; var paredBack:IMaterial; var paredTop:IMaterial; var paredBottom:IMaterial; var sombra:*; this.scene = new Scene3D(); this.sceneplane = new Scene3D(); puntosPared[0]=["v", 10, -1875, -1875, -1875, 1875]; puntosPared[1]=["v", 10, 1875, -1875, 1875, 1875]; puntosPared[2]=["v", 8, -1500, -1500, -1500, 1500]; puntosPared[3]=["v", 8, 1500, -1500, 1500, 1500]; puntosPared[4]=["v", 4, -750, -750, -750, 750]; puntosPared[5]=["v", 4, 750, -750, 750, 750]; puntosPared[6]=["v", 3, 0, 750, 0, 1875]; puntosPared[7]=["v", 2, -1125, -1125, -1125, -375]; puntosPared[8]=["v", 2, -1125, 375, -1125, 1125]; puntosPared[9]=["v", 2, 0, -1875, 0, -1125]; puntosPared[10]=["v", 2, 375, 1125, 375, 1875]; puntosPared[11]=["v", 2, 1125, -1125, 1125, -375]; puntosPared[12]=["v", 2, 1125, 375, 1125, 1125]; puntosPared[13]=["h", 10, -1875, -1875, 1875, -1875]; puntosPared[14]=["h", 5, -1875, 1875, 0, 1875]; puntosPared[15]=["h", 4, -750, -750, 750, -750]; puntosPared[16]=["h", 4, 375, 1875, 1875, 1875]; puntosPared[17]=["h", 3, -1500, -1500, -375, -1500]; puntosPared[18]=["h", 3, 375, -1500, 1500, -1500]; puntosPared[19]=["h", 3, -1125, -1125, 0, -1125]; puntosPared[20]=["h", 3, 0, -1125, 1125, -1125]; puntosPared[21]=["h", 3, -1125, 1125, 0, 1125]; puntosPared[22]=["h", 3, -1500, 1500, -375, 1500]; puntosPared[23]=["h", 2, -1500, 0, -750, 0]; puntosPared[24]=["h", 2, 750, 0, 1500, 0]; puntosPared[25]=["h", 2, 0, 750, 750, 750]; puntosPared[26]=["h", 2, 375, 1125, 1125, 1125]; puntosPared[27]=["h", 2, 750, 1500, 1500, 1500]; puntosPared[28]=["h", 1, -750, 750, -375, 750]; suelo=new BitmapMaterial(this.generateFromLib ("woodplank"), {smooth:false}); paredRight=new BitmapMaterial (this.generateFromLib("muro"), {smooth:false}); paredLeft=new BitmapMaterial (this.generateFromLib("muro"), {smooth:false}); paredFront=new BitmapMaterial (this.generateFromLib("muro"), {smooth:false}); paredBack=new BitmapMaterial (this.generateFromLib("muro"), {smooth:false}); paredTop=new BitmapMaterial (this.generateFromLib("top"), {smooth:false}); paredBottom=new BitmapMaterial (this.generateFromLib("bottom"), {smooth:false}); var materialParedes:Object= {front:paredFront,back:paredBack,left:paredLeft,right:paredRight,top:paredTop,bottom:paredBottom,defaultmaterial:suelo}; var segmentoTemp:Array = new Array (); for (var indice:uint = 0; indice < puntosPared.length; indice++) { segmentoTemp = [new Number3D (puntosPared[indice][2],0,puntosPared [indice][3]),new Number3D(puntosPared[indice][4],0,puntosPared[indice] [5])] pared[indice]=new SegmentsExtrude (segmentoTemp,{axis:"y",offset: 500,subdivision:1,thickness:anchoPared,thickness_subdivision: 1,flip:false,scaling: 1,materials:materialParedes,omit:"top",coverall:false,recenter:true,closepath:false}); this.scene.addChild(pared[indice]); pared[indice].rotationX=180; } this.viewplane=new View3D ({scene:this.sceneplane,renderer:Renderer.BASIC}); this.viewplane.x=stage.stageWidth/2; this.viewplane.y=stage.stageHeight/2; this.viewplane.camera.x=0; this.viewplane.camera.y=3000; this.viewplane.camera.z=-500; this.view=new View3D ({scene:this.scene,renderer:Renderer.BASIC}); this.view.x=stage.stageWidth/2; this.view.y=stage.stageHeight/2; this.view.camera.x=0; this.view.camera.y=3000; this.view.camera.z=-500; this.plane=new Plane({material:suelo,segmentsW: 4,segmentsH:4,width: 4000,height:4000,bothsides:true}); this.sceneplane.addChild(this.plane); material=new BitmapMaterial(Cast.bitmap (MimiTexture)); md2 = new Md2(); md2.material=material; md2.scaling=15; loader = new LoaderCube(); loader.loadersize=100; loader.loadGeometry("mimicorre2.md2", md2); loader.addEventListener (Loader3DEvent.LOAD_SUCCESS, onSuccess); this.scene.addChild(this.loader); this.view.camera.lookAt(this.loader.position); this.viewplane.camera.lookAt (this.loader.position); this.addChild(this.viewplane); this.addChild(this.view); stage.addEventListener(Event.ENTER_FRAME, this.refreshScreen); stage.addEventListener(Event.RESIZE, this.onResize); return; }// end function private function onSuccess(event:Loader3DEvent):void { var puntosCamino:Array = new Array(); var vectorCamino:Array = new Array(); puntosCamino[0]=[0, 0, 0]; puntosCamino[1]=[2.5, -187.5, 937.5]; puntosCamino[2]=[1.5, -750, 937.5]; puntosCamino[3]=[0.5, -937.5, 750]; puntosCamino[4]=[1, -937.5, 375]; puntosCamino[5]=[0.5, -1125, 187.5]; puntosCamino[6]=[0.5, -1312.5, 375]; puntosCamino[7]=[2, -1312.5, 1125]; for (var indice:uint = 0; indice < puntosCamino.length-1; indice++) { vectorCamino.push(new Number3D (puntosCamino[indice][1], 0, puntosCamino[indice][2]), new Number3D((puntosCamino[indice] [1]+puntosCamino[indice+1][1])/2, 0, (puntosCamino[indice] [2]+puntosCamino[indice+1][2])/2), new Number3D(puntosCamino[indice+1] [1], 0, puntosCamino[indice+1][2])); }; var path:Path = new Path (vectorCamino); var init:Object = {duration:5000, lookat:null, aligntopath:true, targetobject:null, offset:new Number3D(0,200,0), rotations:null, fps: 24, easein:false, easeout:false}; model = loader.handle as Mesh; model.scale(1); model.play(new AnimationSequence("corre", true, true, 10)); this.pathanimator = new PathAnimator(path, model, init); var time:Timer = new Timer (100, 100); time.addEventListener(TimerEvent.TIMER, movimiento); time.start(); return; }// end function private function movimiento (e:TimerEvent) { momento = momento + 0.01; trace(momento); this.pathanimator.update (momento); this.view.camera.lookAt (this.pathanimator.position); this.viewplane.camera.lookAt (this.pathanimator.position); } } } Thanks for your help
