I have a small jMonkey program with balls bouncing around. I want to record the 3d vectors of each ball every second.
When I run my code:
@Override
public void simpleUpdate(float tpf) {
if(getTimer().getTimeInSeconds() >= 1) {
out.write("\n" + count + " ");
out.write(ball1g.getLocalTranslation() + " ");
out.write(ball2g.getLocalTranslation() + " ");
out.write(ball3g.getLocalTranslation().toString());
count++;
getTimer().reset();
}
}
My text file is completely blank. But when I run:
@Override
public void simpleUpdate(float tpf) {
out.write("this can be anything bigger than one character wide");
if(getTimer().getTimeInSeconds() >= 1) {
out.write("\n" + count + " ");
out.write(ball1g.getLocalTranslation() + " ");
out.write(ball2g.getLocalTranslation() + " ");
out.write(ball3g.getLocalTranslation().toString());
count++;
getTimer().reset();
}
}
it works, just with a ridiculous amount of characters in between my actual data.
out.write("");
does nothing, it has to be at least
out.write(" ");
or bigger.
Am I doing anything wrong? If not, how can I work around this but accomplish the same task?