Fine , thanks, I will send.Actually this is the only difference between your code and mine
On Sat, Jul 24, 2010 at 6:54 PM, Fabrice3D <[email protected]> wrote: > if you put a try/catch in your enterframe, > does it generate the error once or endlessly? > may be some init delay somewhere, may be the delay is caused by the > AwayTemplate... > > busy on somethin else right now, but will try your class (please send me > your awaytemplate offline as well) > > Fabrice > > > > On Jul 24, 2010, at 5:40 PM, Michael Iv wrote: > > It is really strange though , as I use the same Drag3d class for your test > file and for mine , but in mine if I set drag update permanently the result > is very different..Here is the code: > package > { > import away3d.cameras.HoverCamera3D; > import away3d.cameras.lenses.PerspectiveLens; > import away3d.core.math.Number3D; > import away3d.events.MouseEvent3D; > import away3d.materials.BitmapMaterial; > import away3d.primitives.Sphere; > import away3d.primitives.Trident; > import away3d.tools.utils.Drag3D; > > import flash.display.BitmapData; > import flash.events.Event; > import flash.events.MouseEvent; > > [SWF(backgroundColor="#677999", frameRate="24", quality="LOW", > width="800", height="600")] > public class Drag3dObjects extends AwayTemplate > { > private var _sphere:Sphere; > private var _bitMat:BitmapMaterial; > private var _drag3d:Drag3D; > private var _hoverCam:HoverCamera3D; > private var _oldMouseX:Number=0; > private var _oldMouseY:Number=0; > private var _canMove:Boolean=false; > private var _canDrag:Boolean=false; > private static const EASE_FACTOR:Number=0.9; > public function Drag3dObjects() > { > super(); > setTrident(); > setHowerCamera(); > initDrag(); > } > override protected function initGeometry():void{ > _sphere=new > Sphere({radius:35,material:_bitMat,segmentsH:20,segmentsW:20}); > _view.scene.addChild(_sphere); > //_sphere.position=new Number3D(0,0,0); > > _sphere.addOnMouseDown(onMouse3DDown); > _sphere.addOnMouseUp(onMouse3DUp); > > > > } > private function setTrident():void{ > var trident:Trident=new Trident(1000,true); > _view.scene.addChild(trident); > } > private function onMouse3DDown(e:MouseEvent3D):void{ > _canDrag=true; > > trace(_canDrag); > } > private function onMouse3DUp(e:MouseEvent3D):void{ > _canDrag=false; > > trace(_canDrag); > } > override protected function initListeners():void{ > stage.addEventListener(MouseEvent.MOUSE_DOWN, > onMouseDown,false,0,true); > stage.addEventListener(MouseEvent.MOUSE_UP, > onMouseUp,false,0,true); > } > override protected function initMaterials():void{ > var bdata:BitmapData=new BitmapData(256,256); > bdata.perlinNoise(26,26,18,1534,false,true,7,false); > _bitMat=new BitmapMaterial(bdata); > } > override protected function onEnterFrame(e:Event) : void{ > super.onEnterFrame(e); > _drag3d.updateDrag();///not good > if(_canDrag){///////when updateDrag(); inside this statement > ,it works well > } > ////_drag3d.updateDrag(); > } > if(_hoverCam){ > if(_canMove){ > _hoverCam.panAngle = (stage.mouseX - > _oldMouseX)*EASE_FACTOR ; > _hoverCam.tiltAngle = (stage.mouseY - > _oldMouseY)*EASE_FACTOR ; > > } > > > _hoverCam.hover(); > } > > > } > private function initDrag():void{ > _drag3d=new Drag3D(_view); > _drag3d.object3d=_sphere; > _drag3d.debug=true; > _drag3d.plane="xy";///xy > addEventListener(Event.ENTER_FRAME,onEnterFrame,false,0,true); > } > private function onMouseDown(e:MouseEvent):void{ > _oldMouseX=stage.mouseX; > _oldMouseY=stage.mouseY > _canMove=true; > } > private function onMouseUp(e:MouseEvent):void{ > _canMove=false; > } > private function setHowerCamera():void{ > _hoverCam=new HoverCamera3D(); > _view.camera=_hoverCam; > _hoverCam.target=_sphere; > _hoverCam.distance = 3000; > // _hoverCam.lens=new PerspectiveLens(); > _hoverCam.maxTiltAngle = 80; > _hoverCam.minTiltAngle = 0; > _hoverCam.wrapPanAngle=true; > _hoverCam.steps=8; > _hoverCam.yfactor=1///def 2 > _hoverCam.hover(true); > > } > } > } > > On Sat, Jul 24, 2010 at 6:10 PM, Fabrice3D <[email protected]> wrote: > >> class is updated. >> As said in other thread, all works just fine on my machine. >> sended you offline a test class, >> let me know how it goes. >> >> Fabrice >> >> On Jul 24, 2010, at 4:22 PM, Michael Iv wrote: >> >> It looks like the class is buggy. the objects don't get dragged.Also as >> soon as the scene starts rendering the debug plaines are flying into >> infinity >> >> -- >> Michael Ivanov ,Programmer >> Neurotech Solutions Ltd. >> Flex|Air |3D|Unity| >> www.neurotechresearch.com >> http://blog.alladvanced.net >> http://www.meetup.com/GO3D-Games-Opensource-3D/ >> Tel:054-4962254 >> [email protected] >> [email protected] >> >> >> > > > -- > Michael Ivanov ,Programmer > Neurotech Solutions Ltd. > Flex|Air |3D|Unity| > www.neurotechresearch.com > http://blog.alladvanced.net > http://www.meetup.com/GO3D-Games-Opensource-3D/ > Tel:054-4962254 > [email protected] > [email protected] > > > -- Michael Ivanov ,Programmer Neurotech Solutions Ltd. Flex|Air |3D|Unity| www.neurotechresearch.com http://blog.alladvanced.net http://www.meetup.com/GO3D-Games-Opensource-3D/ Tel:054-4962254 [email protected] [email protected]
