Nope. didn't work correct. May be it's possible to solve this problem with Box2DFlash. But I have no idea how to use Away3D with Box2DFlash. Can somebody show me the simple example of it. Pleaseeee!
On 11 фев, 19:07, katopz <[email protected]> wrote: > jiglib, got some update last week, maybe some issue produce after that > btw, here's lastest example that seem to be work > > http://jiglibflash.googlecode.com/svn/trunk/fp10/examples/away3d > > hth > > On 11 February 2010 22:07, metSyS <[email protected]> wrote: > > > > > > > When I move plate fast up, and ball faling down it falls through the > > plane. I'm only start learning physic engines. May be somebody will > > advise which physic engine is better for away3d and some examples. > > Here is my code: > > > package > > { > > import away3d.cameras.HoverCamera3D; > > import away3d.containers.ObjectContainer3D; > > import away3d.containers.Scene3D; > > import away3d.containers.View3D; > > > import flash.display.Sprite; > > import flash.events.Event; > > import flash.geom.Vector3D; > > > import jiglib.math.*; > > import jiglib.physics.*; > > import jiglib.physics.constraint.*; > > import jiglib.plugin.away3d.*; > > > [SWF(width="1024", height="768", backgroundColor="#FFFFFF", > > frameRate="60")] > > public class Away3DFlash3DPhysics extends Sprite > > { > > private var view:View3D; > > private var cam:HoverCamera3D; > > private var scene:Scene3D; > > > private var ground:RigidBody; > > private var ball:RigidBody; > > private var cube:RigidBody; > > > private var physics:Away3DPhysics; > > > public function Away3DFlash3DPhysics() > > { > > stage.addEventListener(Event.ENTER_FRAME, > > onEnterFrame); > > > init3D(); > > > initObjects(); > > } > > > private function init3D():void > > { > > scene=new Scene3D(); > > > cam=new HoverCamera3D({distance:1000}); > > cam.targetpanangle=cam.panangle=0; > > cam.targettiltangle=cam.tiltangle=10; > > > view=new View3D({camera:cam, x:stage.stageWidth/2, > > y:stage.stageHeight/2}); > > addChild(view); > > > physics=new Away3DPhysics(view, 8); > > } > > > private function initObjects():void > > { > > ground=physics.createCube({segmentsH:10, > > segmentsW:10, width:200, > > height:5, depth:200, rotationX:30, material:"silver"}); > > ground.movable = true; > > ground.mass=100; > > ground.friction = 0.9; > > ground.restitution = 0.9; > > > ball=physics.createSphere({radius:20,/* > > segmentsH:20, segmentsW: > > 20,*/ material:"green#red"}); > > ball.mass=.25; > > ball.friction=.2; > > ball.restitution=8; > > ball.moveTo(new Vector3D(0, 1000, 0)); > > ball.movable = true; > > } > > > private function onEnterFrame(event:Event):void > > { > > > physics.engine.integrate(0.2); > > > ground.rotationZ=(512-stage.mouseX)*0.1; > > > ground.x=(512-stage.mouseX); > > ground.y=(384-stage.mouseY); > > > if(ball.y<-3000) > > { > > > ball.y=1500; > > if(ball.x<-512 || ball.x>512) > > { > > ball.x=0; > > } > > } > > > cam.hover(); > > view.render(); > > } > > } > > > } > > -- > katopzhttp://www.sleepydesign.com
