Horse racing game

I am thinking of creating a horse racing game using JME.



I try to modify the jmetest.input.TestThirdPersonController where it chase a 3D Box.

http://www.koders.com/java/fidEED130FD41C3CC12967AC2F9F60BC5BF6DDB262A.aspx



How to replace the box with a Horse 3D model and trace horse's back.



http://www.oniva.com/upload/1356/horse.jpg



Code to load 3D horse model ( not trace it's back ):

==============================

    private void setupCharacter() {

    URL modelToLoad = TestMaxJmeWrite.class.getClassLoader().getResource(

        "jmetest/data/model/Horse.3DS");

    Node r1 = null;



        try {

            MaxToJme C1 = new MaxToJme();

            ByteArrayOutputStream BO = new ByteArrayOutputStream();

            C1.convert(new BufferedInputStream(modelToLoad.openStream()), BO);

            r1 = (Node)BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));



            r1.setLocalScale(.1f);

            r1.setLocalTranslation(new Vector3f(10,0,0));

           

            r1.setModelBound(new BoundingBox());

            r1.updateModelBound();





}



Then the code - m_character.getWorldBound() will get null point exception:

==============================

    private void setupChaseCamera() {

        Vector3f targetOffset = new Vector3f();

        targetOffset.y = ((BoundingBox) m_character.getWorldBound()).yExtent * 1.5f;

        chaser = new ChaseCamera(cam, m_character);

        chaser.setTargetOffset(targetOffset);

    }

so Node r1 is a child of m_character?

did you call m_character.updateWorldbound() after attaching r1 to m_character?

Yes I did call that, the following is the continued code



=====================



      m_character = new Node("char node");

        rootNode.attachChild(m_character);

        m_character.attachChild(r1); // instead of attach box, now attach a model

        m_character.updateWorldBound();



        TextureState ts = display.getRenderer().createTextureState();

        ts.setEnabled(true);

        ts.setTexture(

            TextureManager.loadTexture(

            TestThirdPersonController.class.getClassLoader().getResource(

            "jmetest/data/images/Monkey.jpg"),

            Texture.MM_LINEAR,

            Texture.FM_LINEAR));

        m_character.setRenderState(ts);

    }

how to load the 3D model that only look at horse's back ( horse racing game )



the code to load the 3D model

=======================================

            MaxToJme C1 = new MaxToJme();

            ByteArrayOutputStream BO = new ByteArrayOutputStream();

            C1.convert(new BufferedInputStream(modelToLoad.openStream()), BO);

            r1 = (Node)BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));



            r1.setLocalScale(.1f);

            r1.setLocalTranslation(new Vector3f(10,0,0));