ihave a body lets say its liek this both spheres are connected so when i move one other moves too lets say center of mass is hooked so i can only rotate this 'body'
So whenever i apply a force to one sphere the rotation occurs and it produces drag, now how should i apply this drag (i understand that drag will be generated for both spheres)
my code looks like this
for (int i=0; i <num_of_spheres; i++)
{
if (i==0) apply_force_to_this_sphere();
vec3 cog2cob_vec = vectorAB(pos + WORLD_MAT * CENTER_OF_GRAVITY, sphere[i].geometric_center);
vec3 ETorque = cog2cob_vec * SPHERE_FORCE;
vec3 EAngAcc = ETorque / EMOI;
vec3 EAngVel = EAngAcc*dt;
vec3 EAngMov = EAngVel*dt;
vLocalAngularMoment = vLocalAngularMoment + EAngMov*RAD_TO_DEG;
}
Now i am confused where in the code should i apply drag
should i first calculate the rotation without drag then check for angular velocity and then apply drag force and change angular velocity again?
or should i apply drag to each sphere like
for (int i=0; i <num_of_spheres; i++) {
if (i==0) apply_force_to_this_sphere();
for (int n=0; n < num_of_spheres; n++)
if (i!=n)
{
apply drag to each sphere
}
or
for (int i=0; i <num_of_spheres; i++)
{
vec3 SPHERE_FORCE = vec3(0.0, 0.0,0.0);
if (i==0) apply_force_to_this_sphere(); //SPHERE_FORCE = SPHERE_FORCE + thrust
vec3 cog2cob_vec = vectorAB(pos + WORLD_MAT * CENTER_OF_GRAVITY, sphere[i].geometric_center);
vec3 ETorque = cog2cob_vec * (SPHERE_FORCE+drag_for_this_sphere_based_on_angular_vel);
vec3 EAngAcc = ETorque / EMOI;
vec3 EAngVel = EAngAcc*dt;
vec3 EAngMov = EAngVel*dt;
vLocalAngularMoment = vLocalAngularMoment + EAngMov*RAD_TO_DEG;
}
thus last example shows that angular vel will change each iteration thus i think it will somehow apply greater drag to other sphere, and since distance from center_of_mass to both spheres in this case is the same it should have the same drag value(not direction but length)
so how do i do it?