cvar_t physics_ode_contact_mu = {0, "physics_ode_contact_mu", "1", "contact solver mu parameter - friction pyramid approximation 1 (see ODE User Guide)"};
cvar_t physics_ode_contact_erp = {0, "physics_ode_contact_erp", "0.96", "contact solver erp parameter - Error Restitution Percent (see ODE User Guide)"};
cvar_t physics_ode_contact_cfm = {0, "physics_ode_contact_cfm", "0", "contact solver cfm parameter - Constraint Force Mixing (see ODE User Guide)"};
+cvar_t physics_ode_world_erp = {0, "physics_ode_world_erp", "-1", "world solver erp parameter - Error Restitution Percent (see ODE User Guide); use defaults when set to -1"};
+cvar_t physics_ode_world_cfm = {0, "physics_ode_world_cfm", "-1", "world solver cfm parameter - Constraint Force Mixing (see ODE User Guide); not touched when -1"};
cvar_t physics_ode_iterationsperframe = {0, "physics_ode_iterationsperframe", "4", "divisor for time step, runs multiple physics steps per frame"};
cvar_t physics_ode_movelimit = {0, "physics_ode_movelimit", "0.5", "clamp velocity if a single move would exceed this percentage of object thickness, to prevent flying through walls"};
cvar_t physics_ode_spinlimit = {0, "physics_ode_spinlimit", "10000", "reset spin velocity if it gets too large"};
Cvar_RegisterVariable(&physics_ode_contact_mu);
Cvar_RegisterVariable(&physics_ode_contact_erp);
Cvar_RegisterVariable(&physics_ode_contact_cfm);
+ Cvar_RegisterVariable(&physics_ode_world_erp);
+ Cvar_RegisterVariable(&physics_ode_world_cfm);
Cvar_RegisterVariable(&physics_ode_iterationsperframe);
Cvar_RegisterVariable(&physics_ode_movelimit);
Cvar_RegisterVariable(&physics_ode_spinlimit);
world->physics.ode_world = dWorldCreate();
world->physics.ode_space = dQuadTreeSpaceCreate(NULL, center, extents, bound(1, physics_ode_quadtree_depth.integer, 10));
world->physics.ode_contactgroup = dJointGroupCreate(0);
- // we don't currently set dWorldSetCFM or dWorldSetERP because the defaults seem fine
+ if(physics_ode_world_erp.value >= 0)
+ dWorldSetERP(world->physics.ode_world, physics_ode_world_erp.value);
+ if(physics_ode_world_cfm.value >= 0)
+ dWorldSetCFM(world->physics.ode_world, physics_ode_world_cfm.value);
}
#endif
break;
case JOINTTYPE_HINGE2:
break;
- case JOINTTYPE_PISTON:
- break;
}
return;
}
case JOINTTYPE_HINGE2:
j = dJointCreateHinge2(world->physics.ode_world, 0);
break;
- case JOINTTYPE_PISTON:
- j = dJointCreatePiston(world->physics.ode_world, 0);
- break;
case 0:
default:
// no joint
dJointSetHinge2Axis1(j, forward[0], forward[1], forward[2]);
dJointSetHinge2Axis2(j, velocity[0], velocity[1], velocity[2]);
break;
- case JOINTTYPE_PISTON:
- dJointSetPistonAxis(j, forward[0], forward[1], forward[2]);
- break;
case 0:
default:
Host_Error("what? but above the joint was valid...\n");