 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
LarryTM
Joined: 04 Jul 2006 Posts: 30
|
Posted: Mon Dec 29, 2008 12:26 am Post subject: ODE hangs on collision. |
|
|
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? |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Mon Dec 29, 2008 10:11 am Post subject: |
|
|
| If I remember correctly, the last time someone had this same problem, it was because the stack was too small. The ODE collision example needs at least a 1MB stack to run. The default stack on the PSP is 256KB. |
|
| Back to top |
|
 |
LarryTM
Joined: 04 Jul 2006 Posts: 30
|
Posted: Wed Dec 31, 2008 9:29 am Post subject: |
|
|
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
| Code: |
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);
|
Creating Cylinder object :
| Code: |
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);
|
And collision :
| Code: |
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);
}
|
Any ideas? |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Wed Dec 31, 2008 1:17 pm Post subject: |
|
|
| LarryTM wrote: | How to increase stack size?
Any ideas? |
Click the search button at the top of the page, set the forum to PSP Development, then enter the term "STACK_SIZE". SHEESH! Kids these days... in MY day, we had to walk twenty miles to find the answer! In the snow! Uphill!
:D |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|