I noticed i have problem with torque and rotations all along with wrong calculated drag
this is what i apply consider 3 forces for each box: buoyancy + drag + gravity;
theres also velocity vector

take a look at the right 'box'
this violet pink arrow pointing down -> velocity vector
green arrows -> gravity vector;
yellow arrows -> buoyant vector
orange arrows -> drag vector; //as you can see i connect it to the same point i connect gravity one
red is submerged vol
(i am watching at right example with 4 boxes) :
ok back to the example the thing is i dont see any angular change like it would never happen so this is what i do
[spoiler]
set resultant_force = 0;
for each box()
{
calculate overall speed for drag calculation for this box; localspeed -> vel + overall_rotation_translation x modelrelative_COG2COB_vector
LocalSpeedVec = vel + cross( angular_translation, vectorAB( CENTER_OF_GRAVITY, BuoyancyBox[n].center) )
//vectorAB( CENTER_OF_GRAVITY, BuoyancyBox[n].center) <- is a constant it never changes .center like CENTER_OF_GRAVITY are in modelspace
now having velocity vector we can compute drag = (-LocalSpeedVec/ length(LocalSpeedVec) * ( length(LocalSpeedVec) * length(LocalSpeedVec) ) * surface_area * drag_coeff; here is strange thing coz i get NaNs here.
box_force[n].FORCE = Gravity + drag; // i am wondering what is the standard unit for sirface area maybe its because i use m^2 as unit
now from this point i go into two new ones:
first: i need to attach gravity + thrust + drag (- > which is box_force[n].FORCE) to BOX center, and apply resulting torque
second:
now whenevers buoyancy (if body is submerged in water) i add to this force (buoyancy) i make a torque wheres Torque = R x F
wheres R = vector from center of gravity to center_of_buoyancy_calculated_earlier
F = buoyancy force;
ofc to get angtranslation from it i need to to sth like:
vec3 ETorque = cog2cob_vec * BuoyancyBox[n].buoyancy_force;
vec3 EAngAcc = ETorque / EMOI;
vec3 EAngVel = EAngAcc*dt;
vec3 EAngMov = EAngVel*dt;
and i dd that to resuklting torque where our resulting_torque is actually angular_trianslation where:
angular_trianslation = angular_trianslation + EAngMov;
}
//gravity pointed 0, -1, 0); buyoyancy force pointed (0, 1, 0); they act in these dirs
now i rotate and translate my object by given data.
[/spoiler]
so i basically need to know if i missed some kind of step i am not aware. or this is totally wrong of toing my thing :P
how i think it works:
its like when you saw first seconds in a first vid below you can see that model is dropped from a height and its a bit rotated)
so box cubes that fall as first to water generate torque = body - box->pos X buoyancy force -> so it should also rotate the object
it should but it isnt even implementing resistance that when entering water density gets almost 1000 times bigger
and that triggers way bigger drag but still nothing