On modifying the damping force in source code

Hi there,

I am changing the damping force formula in the source code, and I want the damping force to be proportional to incidentVn**1.5 instead of incidentVn. Am I correct as follows?

Thanks!

double cn = Cn_crit*phys->viscousDamping; // Damping normal coefficient

/* Add normal viscous component if damping is included */
Vector3r incidentVn_Test=incidentVn;
double sign_1=Sgn(incidentVn_Test[0]);
double sign_2=Sgn(incidentVn_Test[1]);
double sign_3=Sgn(incidentVn_Test[2]);
#Here Sgn is a function to return the sign (1 or minus 1)

incidentVn_Test[0]=sign_1*pow(fabs(incidentVn_Test[0]),1.5);
incidentVn_Test[1]=sign_2*pow(fabs(incidentVn_Test[1]),1.5);
incidentVn_Test[2]=sign_3*pow(fabs(incidentVn_Test[2]),1.5);
#Here I change the component of the Vector3r respectively

phys->normalViscous = cn*incidentVn_Test;
/* Add normal viscous component if damping is included */

phys->normalForce -= phys->normalViscous;

Question information

Language:
English Edit question
Status:
Expired
For: