PRVM_DECLARE_clientfieldfloat(mass)
PRVM_DECLARE_clientfieldvector(massofs)
PRVM_DECLARE_clientfieldfloat(friction)
+PRVM_DECLARE_clientfieldfloat(erp)
PRVM_DECLARE_clientfieldfloat(modelindex)
PRVM_DECLARE_clientfieldfloat(movetype)
PRVM_DECLARE_clientfieldfloat(nextthink)
PRVM_DECLARE_field(mass)
PRVM_DECLARE_field(massofs)
PRVM_DECLARE_field(friction)
+PRVM_DECLARE_field(erp)
PRVM_DECLARE_field(max_health)
PRVM_DECLARE_field(maxs)
PRVM_DECLARE_field(message)
PRVM_DECLARE_serverfieldfloat(mass)
PRVM_DECLARE_serverfieldvector(massofs)
PRVM_DECLARE_serverfieldfloat(friction)
+PRVM_DECLARE_serverfieldfloat(erp)
PRVM_DECLARE_serverfieldfloat(max_health)
PRVM_DECLARE_serverfieldfloat(modelflags)
PRVM_DECLARE_serverfieldfloat(modelindex)
float bouncestop1 = 60.0f / 800.0f;
float bouncefactor2 = 0.0f;
float bouncestop2 = 60.0f / 800.0f;
+ float erp;
dVector3 grav;
prvm_edict_t *ed1, *ed2;
dWorldGetGravity((dWorldID)world->physics.ode_world, grav);
bouncestop1 *= fabs(grav[2]);
+ // get erp
+ // select object that moves faster ang get it's erp
+ erp = (VectorLength2(PRVM_gameedictvector(ed1, velocity)) > VectorLength2(PRVM_gameedictvector(ed2, velocity))) ? PRVM_gameedictfloat(ed1, erp) : PRVM_gameedictfloat(ed2, erp);
+
// generate contact points between the two non-space geoms
numcontacts = dCollide(o1, o2, MAX_CONTACTS, &(contact[0].geom), sizeof(contact[0]));
// add these contact points to the simulation
{
contact[i].surface.mode = (physics_ode_contact_mu.value != -1 ? dContactApprox1 : 0) | (physics_ode_contact_erp.value != -1 ? dContactSoftERP : 0) | (physics_ode_contact_cfm.value != -1 ? dContactSoftCFM : 0) | (bouncefactor1 > 0 ? dContactBounce : 0);
contact[i].surface.mu = physics_ode_contact_mu.value * ed1->priv.server->ode_friction * ed2->priv.server->ode_friction;
- contact[i].surface.soft_erp = physics_ode_contact_erp.value;
+ contact[i].surface.soft_erp = physics_ode_contact_erp.value + erp;
contact[i].surface.soft_cfm = physics_ode_contact_cfm.value;
contact[i].surface.bounce = bouncefactor1;
contact[i].surface.bounce_vel = bouncestop1;