Hi, dear all. I wrote a simple program HelloMy.java as follows. It extends SimpleGame and I changed the cam's settings in the method setUpCamera(). Then I run it, but I can't turn the camera left or right anymore. Anyone helps?
import com.jme.app.SimpleGame;
import com.jme.scene.shape.Box;
import com.jme.math.Vector3f;
:D, really thank you, man. Really appreciate your help. Thx again. Really happy now.
The problem is that when the input handler is created in SimpleGame, it is given a camera whose up axis is the y-axis. That is locked in to prevent rolling. When you change the camera attributes to use a z up axis, then y is still locked in the input handler. Unfortunately, you can't change the lock very easily, so your only course of action is to recreate the inputhandler. This is pretty easy, only 3 lines of code. So change your setUpCamera like so:
private void setUpCamera(){
cam.setLocation(new Vector3f(-5,-1,5));
cam.setDirection(new Vector3f(1,0,0));
cam.setLeft(new Vector3f(0,1,0));
cam.setUp(new Vector3f(0,0,1));
cam.update();
/** Create a basic input controller. */
input = new FirstPersonHandler(this, cam, properties.getRenderer());
/** Signal to all key inputs they should work 10x faster. */
input.setKeySpeed(10f);
input.setMouseSpeed(1f);
}
Good luck on your next steps in jME!
We aim to please. XD