Hi,
I have strange problem with ODE. When i compile sample app from ODE or my own app, it works fine on PC, but hangs up on PSP.
My psp hangs up when objects gets collision. When objects don't collide my app is working.
I use latest pspsdk and ODE from ps2dev SVN.
Anyone can help me?
ODE hangs on collision.
How to increase stack size?
I've made a few tests and i think that the problem exists when i use CCylinder collision with Trimesh.
When i use Box object with Trimesh everything works fine. Here's my code :
Creating trimesh
Creating Cylinder object :
And collision :
Any ideas?
I've made a few tests and i think that the problem exists when i use CCylinder collision with Trimesh.
When i use Box object with Trimesh everything works fine. Here's my code :
Creating trimesh
Code: Select all
fiz_info.world = dWorldCreate();
fiz_info.space = dHashSpaceCreate (0);
fiz_info.contactgroup = dJointGroupCreate (0);
dWorldSetGravity (fiz_info.world,0,0,-9.8);
dWorldSetQuickStepNumIterations (fiz_info.world, 64);
dTriMeshDataID Data = dGeomTriMeshDataCreate();
dGeomTriMeshDataBuildSingle
(
Data,
fiz_info.vertexy,
3 *sizeof(dReal),
fiz_info.ile_vert/3,
fiz_info.indexy,
fiz_info.ile_ind,
3*sizeof(int)
);
fiz_info.world_mesh = dCreateTriMesh(fiz_info.space, Data, 0, 0, 0);
dGeomTriMeshEnableTC(fiz_info.world_mesh, dSphereClass, false);
dGeomTriMeshEnableTC(fiz_info.world_mesh, dBoxClass, false);
dGeomSetPosition(fiz_info.world_mesh, 0, 0, 0);
dRFromAxisAndAngle (R, 0,1,0, 0);
dGeomSetRotation (fiz_info.world_mesh, R);
Code: Select all
robot->obiekt.TriBody=dBodyCreate (Level01->fiz_info.world);
dMassSetCylinderTotal (&robot->obiekt.masa,4,1,robot->obiekt.wymiary.x/2,robot->obiekt.wymiary.z/2);
dBodySetMass (robot->obiekt.TriBody,&robot->obiekt.masa);
robot->obiekt.TriMesh=dCreateCCylinder(Level01->fiz_info.space,robot->obiekt.wymiary.x/2,robot->obiekt.wymiary.z/2);
dGeomSetBody (robot->obiekt.TriMesh,robot->obiekt.TriBody);
Code: Select all
static void nearCallback (void *data, dGeomID o1, dGeomID o2)
{
const int MAX_CONTACTS = 5;
int i;
dBodyID b1 = dGeomGetBody(o1);
dBodyID b2 = dGeomGetBody(o2);
dContact contact[MAX_CONTACTS];
for (i = 0; i < MAX_CONTACTS; i++)
{
contact[i].surface.mode = dContactSlip1 | dContactSlip2 |
dContactSoftERP | dContactSoftCFM | dContactApprox1;
contact[i].surface.mu = dInfinity;
contact[i].surface.slip1 = 0.1;
contact[i].surface.slip2 = 0.1;
contact[i].surface.soft_erp = 0.5;
contact[i].surface.soft_cfm = 0.3;
}
if (int numc = dCollide(o1, o2, MAX_CONTACTS, &contact[0].geom, sizeof(dContact)))
{
for (i = 0; i < numc; i++)
{
dJointID c = dJointCreateContact(Level01->fiz_info.world, Level01->fiz_info.contactgroup, contact + i);
dJointAttach(c, b1, b2);
}
}
}
static void simLoop (atr3d *scenka)
{
dSpaceCollide(scenka->fiz_info.space, 0, &nearCallback);
dWorldQuickStep(scenka->fiz_info.world, 0.1);
dJointGroupEmpty(scenka->fiz_info.contactgroup);
}