Hello !
The text file which is created in this code, is not good. I don't have the good values.
I suppose my problem is about this line :
float delta_x = (((nv_data [59].positions [frame] - nv_data [59].positions [frame - 1]).z) * 0.001f);
I think it takes :
nv_data[59].positions[20]-nv_data[59].positions[19]
nv_data[59].positions[40]-nv_data[59].positions[39]
nv_data[59].positions[60]-nv_data[59].positions[59]
...
or :
nv_data[59].positions[20]-nv_data[59].positions[0]
nv_data[59].positions[21]-nv_data[59].positions[1]
nv_data[59].positions[22]-nv_data[59].positions[2]
...
or :
nv_data[59].positions[20]-nv_data[59].positions[19]
nv_data[59].positions[21]-nv_data[59].positions[20]
nv_data[59].positions[22]-nv_data[59].positions[21]
...
Instead of : (and it's it that I want)
nv_data[59].positions[20]-nv_data[59].positions[0]
nv_data[59].positions[40]-nv_data[59].positions[20]
nv_data[59].positions[60]-nv_data[59].positions[40]
...
I want to use only each frame / 20 .
Here the part of the code where it appears :
void FixedUpdate() {
delta_time += Time.deltaTime;
if (frame < nv_data [0].positions.Length) {
if ((frame % 20) == 0) {
for (int k = 0; k < body.Length; ++k) {
if (body [k] != null) {
body [k].transform.localPosition = nv_data [k].positions [frame] / 1000;
} else
continue;
}
Debug.Log("Frame_animation : " + frame);
if (indice_3 < forces_dup.Length-1) {
if (frame >= 20) {
Debug.Log ("Frame_writer : " + frame);
float delta_x = (((nv_data [59].positions [frame] - nv_data [59].positions [frame - 1]).z) * 0.001f);
vitesse = delta_x / Time.deltaTime;
acceleration = (vitesse - ancienne_vitesse) / Time.deltaTime;
ancienne_vitesse = vitesse;
indice_3 ++;
StreamWriter writer = new StreamWriter ("Masse-fois-Accelerations_FR_5Hz", true);
using (writer) {
writer.WriteLine (Time.time + "\t" + 80*acceleration + "\t" + forces_dup [indice_3].x);
}
}
}
}
frame++;
}
}
Thank you very much in advance for your help