Here in this exemple of HelloLoop that i found on the website, i just made very small modification to show my probleme.
I see Lags… if i don t set the frame rate, it’s over 2000 fps (Linux / nvidia quadro)
Is there a beter way, that i will not see lags ?
with java3d by having a thread who was taking in account the calculation time and by stoping the view during calculation i don’t have this effect.
I have a nice simulator that i wrote in java3d and i would love to move to JME to add shaders/physics, water and more…
so is there a beter way to avoid lags ? is that because of float accuracy ? should I use a variable and force the rotation a the variable value ?
regards
[java]
package jme3test.helloworld;
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
/** Sample 4 - how to trigger repeating actions from the main event loop.
- In this example, we make the player character rotate. /
public class HelloLoop extends SimpleApplication {
public static void main(String[] args){
HelloLoop app = new HelloLoop();
//AppSettings settings = new AppSettings(true);
//settings.setFrameRate(200);
//app.setSettings(settings);
app.start();
}
protected Geometry player;
@Override
public void simpleInitApp() {
cam.setLocation(new Vector3f(0,-60,0));
cam.lookAt(Vector3f.ZERO, new Vector3f(0, 1,0));
cam.setFrustumFar(100);
Box b = new Box(Vector3f.ZERO, 15, 1, 1);
player = new Geometry(“blue cube”, b);
Material mat = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);
mat.setColor(“m_Color”, ColorRGBA.Blue);
player.setMaterial(mat);
rootNode.attachChild(player);
}
/ This is the main event loop /
@Override
public void simpleUpdate(float tpf) {
// make the player rotate
player.rotate(0, 2tpf, 0);
}
}
[/java]