Trying to use ThirdPersonController

I've been trying to put a third person controller camera onto a sphere. Unfortunately, I've been using BaseGame and the only example I have (TestThirdPersonController.java) uses SimpleGame.



Everything seems to go fine until setting up the controls. Creating the hashmap is fine, but it looks like I'm trying to create a new object of type ThirdPersonController using three variables, but I'm assigning it to a variable called "input" which is not declared in the TestThirdPersonController.java code. I can only guess that "input" is a variable created by SimpleGame.



What is it's type, so I can replicate it in BaseGame?

Alright I seem to have solved my first problem but I still cannot move my camera, I’m stuck looking at the same thing: this.



Here is my code…




import com.jme.app.BaseGame;
import com.jme.bounding.BoundingBox;
import com.jme.bounding.BoundingSphere;
import com.jme.input.ChaseCamera;
import com.jme.input.InputHandler;
import com.jme.input.KeyBindingManager;
import com.jme.input.KeyInput;
import com.jme.input.ThirdPersonHandler;
import com.jme.math.FastMath;
import com.jme.math.Vector3f;
import com.jme.renderer.Camera;
import com.jme.renderer.ColorRGBA;
import com.jme.scene.Node;
import com.jme.scene.shape.Sphere;
import com.jme.system.DisplaySystem;
import com.jme.system.JmeException;
import com.jme.util.Timer;
import com.jmex.terrain.TerrainPage;
import com.jmex.terrain.util.RawHeightMap;
import java.util.ArrayList;
import java.util.HashMap;

public class FyrestoneClient extends BaseGame
{
    /*Screen Resolution Variables*/
    int width, height, depth, freq;
    boolean fullscreen;
    /*End Screen Resolution Variables*/
   
    private Node scene;
    private Node myChar;
   
    private ChaseCamera chase;
    private Camera cam;
   
    protected InputHandler input;
    protected float tpf;
   
    protected Timer timer;
   
    public static void main(String args[])
    {
        FyrestoneClient app = new FyrestoneClient();
        app.setDialogBehaviour(app.FIRSTRUN_OR_NOCONFIGFILE_SHOW_PROPS_DIALOG);
        app.start();
    }

    @Override
    protected void update(float interpolation)
    {
        timer.update();
        interpolation = timer.getTimePerFrame();
        tpf = timer.getTimePerFrame();
        if(KeyBindingManager.getKeyBindingManager().isValidCommand("exit"))
            finished = true;
    }

    @Override
    protected void render(float interpolation)
    {
        display.getRenderer().clearBuffers();
        display.getRenderer().draw(scene);
    }

    @Override
    protected void initSystem()
    {
        //Store Screen Resolution Info
        width = properties.getWidth();
        height = properties.getHeight();
        depth = properties.getDepth();
        freq = properties.getFreq();
        fullscreen = properties.getFullscreen();
        //End Screen Resolution Storage
       
        //Set up screen and camera
        try
        {
            display = DisplaySystem.getDisplaySystem(properties.getRenderer());
            display.createWindow(width, height, depth, freq, fullscreen);
            cam = display.getRenderer().createCamera(width, height);
        }
        catch (JmeException e)
        {
            e.printStackTrace();
            System.exit(1);
        }
        //End setup for screen and camera
       
        //Background color
        display.getRenderer().setBackgroundColor(ColorRGBA.black);
        //End Background color
       
        //Setting up camera to look at the terrain
        cam.setFrustumPerspective(45.0f, (float)width / (float)height, 1, 1000);
        Vector3f loc = new Vector3f(500f, 150f, 500f);
        Vector3f left = new Vector3f(-1.0f, 0.0f, 0.0f);
        Vector3f up = new Vector3f(0.0f, 1.0f, 0.0f);
        Vector3f dir = new Vector3f(0.0f, 0.0f, -1.0f);
       
        cam.setFrame(loc, left, up, dir);
       
        cam.update();
       
        display.getRenderer().setCamera(cam);
        //End camera movements
       
        //Timer for FPS
        timer = Timer.getTimer();
        //End Timer
       
        KeyBindingManager.getKeyBindingManager().set("exit", KeyInput.KEY_ESCAPE);
    }

    @Override
    protected void initGame()
    {
        scene = new Node("Root");
        myChar = new Node("Character Node");
        cam.update();
        Vector3f terrainScale = new Vector3f(1f,1f,1f);
       
        RawHeightMap myMap = new RawHeightMap("1.raw", 513, RawHeightMap.FORMAT_16BITLE, false);
        myMap.setHeightScale(.001f);
        TerrainPage page = new TerrainPage("1", 33, myMap.getSize(), terrainScale, myMap.getHeightMap(), false);
       
        page.setLocalTranslation(new Vector3f(0f,0f,0f));
        page.setDetailTexture(1, 1);
       
        Sphere s = new Sphere("player", 30,30,25);
        s.setLocalTranslation(new Vector3f(0f,0f,0f));
        s.setModelBound(new BoundingBox());
        s.updateModelBound();
        myChar.attachChild(s);
        myChar.updateWorldBound();
       
        Vector3f offset = new Vector3f();
        offset.y = ((BoundingBox)myChar.getWorldBound()).yExtent * 1.5f;
        chase = new ChaseCamera(cam, myChar);
        chase.setTargetOffset(offset);
       
        HashMap<String, Object> handlerProps = new HashMap<String, Object>();
        handlerProps.put(ThirdPersonHandler.PROP_DOGRADUAL, "true");
        handlerProps.put(ThirdPersonHandler.PROP_TURNSPEED, ""+(1.0f * FastMath.PI));
        handlerProps.put(ThirdPersonHandler.PROP_LOCKBACKWARDS, "false");
        handlerProps.put(ThirdPersonHandler.PROP_CAMERAALIGNEDMOVE, "true");
        input = new ThirdPersonHandler(myChar, cam, handlerProps);
        input.setActionSpeed(100f);
       
        scene.attachChild(page);
        scene.updateGeometricState(0.0f, true);
        scene.updateRenderState();
    }

    @Override
    protected void reinit()
    {
        display.recreateWindow(width, height, depth, freq, fullscreen);
    }

    @Override
    protected void cleanup()
    {
       
    }
   
}

you need to update the Thirdperson controller in your update method: input.update(tpf);

Tried, still not able to move.