[ODE] Problem with collisions

João Pereira joaopedro17 at netvisao.pt
Thu Oct 4 07:13:16 MST 2007


Hello,
Im new to ODE and started working with it because i have a project on my 
University that need it.

Im trying to start with a simple example a ball falling and a plane.
When the ball hit's the plane should get up again.



do i need a space collision to get this done????

I have created a simpleSpace and the ball just go through the plane and 
keeps falling.

i created the ball has

typedef struct ic3dPos{
    dReal x;
    dReal y;
    dReal z;
}ic3dPos_t;

typedef struct icBody{
    dBodyID bId;
    dGeomID gId;
    ic3dPos_t pos;
    dMass mass;
}icBody_t;
#define sphereMass 0.5
#define sphereRadius 1
   
icBody_t ball;
icBody_t floor2;
dSpaceID space;

    ball.bId = dBodyCreate( world );
    pos = (ic3dPos_t *) dBodyGetPosition( ball.bId );
    ball.gId = dCreateSphere( space , sphereRadius );


    ball.pos.x = 0;
    ball.pos.y = 0;
    ball.pos.z = 10;

    dBodySetPosition( ball.bId , ball.pos.x , ball.pos.y , ball.pos.z );
   
    //set's the mass parameters
    dMassSetSphereTotal(&ball.mass , sphereMass , sphereRadius );
    dBodySetMass( ball.bId , &ball.mass );


and the plane has

floor2.gId = dCreatePlane( space , 0 , 0 , 1 , -1 );

do i need to do something to make the ball go up when its the plane????


Thanks for the help

João Pereira



More information about the ODE mailing list