Sphere dropping through ground plane ? 

Software: Away3D 4.x

dragovian, Newbie
Posted: 16 March 2012 12:49 AM   Total Posts: 3

I’ve been going through a lot of the different physics engines ( jiglib, alternativa3D physics ) and now awayPhysics. It looks very neat and the performance on the new version of away3D is amazing.

However i’ve written a small piece of code to test a simple “bounce” example. But for some reason my ball drops through the ground static plane that i set up ?

Anyone got any ideas ?

// PHYSICS WORLD SET UP 
physicsWorld AWPDynamicsWorld.getInstance();
physicsWorld.initWithDbvtBroadphase();
...
// GROUND SET UP 
var ground:Mesh = new Mesh(new PlaneGeometry(500,500,1,1,false));
   
scene.addChild(ground);
   
ground.rotationX 90;
   
   var 
c_2D:Texture2DBase = new BitmapTexture(
    (new 
texture_ground() as Bitmap).bitmapData
   
);
   
   
ground.material = new TextureMaterial(c_2D,true,true);
   
   var 
ground_shape AWPStaticPlaneShape = new AWPStaticPlaneShape(new Vector3D,0);
   var 
ground_rigid AWPRigidBody = new AWPRigidBody(ground_shapeground0);
   
physicsWorld.addRigidBody(ground_rigid);
...

// BALL SET UP 
var ball:Mesh = new Mesh(new SphereGeometry(BALL_RADIUS,16,12,true));
   
scene.addChild(ball);
   
   var 
c_2D:Texture2DBase = new BitmapTexture(
    (new 
texture_ball() as Bitmap).bitmapData
   
);
   
   
ball.material = new TextureMaterial(c_2D,true,false);
   
   var 
ball_shape AWPSphereShape = new AWPSphereShape(BALL_RADIUS);
   
ball_rigid = new AWPRigidBody(ball_shapeball0.5);
   
physicsWorld.addRigidBody(ball_rigid);
   
ball_rigid.300;

... 

i really can’t see the issue :/

   

dragovian, Newbie
Posted: 16 March 2012 09:42 AM   Total Posts: 3   [ # 1 ]

Hey guys, just a heads up to say i fixed the problem.

It was kinda late last night and i didn’t notice that i forgot to fill in the vector for my ground_shape ^^

so the vector for the ground shape should be something like this smile

new Vector3D(0,1,0

I will also fork the awayphysics examples this weekend and try update them to work with the newer Away3D 4.X version ( since they have no cubes, spheres, etc but use meshes based on a geometry object )

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X