No animation with CameraGameState

Dear guys,

I have a problem with animation. I load 1 animation model 3DS. If I use Simple game, the wheels of car are rotated so well. But, when I attach to the CameraGameState, the wheels are not rotated. Although I already updateGeometricState() of rootNode. Any one knows about this problem, please help me!!

What game implementation do you use, StandardGame, or SimpleGame or your another/ your own ?

Did you add your CameraGameState to the GameStateManager, and is the GamestateManager updating the States ?

In my game Ive found that If I update the node animation is attached to like this

node.updateGeometricState(0,false)

I get no animations but if I pass tpf to update it works

node.updateGeometricState(tpf,false)

good luck, hope this helps

Hi guys

I'm using FixedLogicrateGame to implement my game.

I already add CameraGameState to GameStateManager and also call "update" for GameStateManager but it doesn't work.

I already call node.updateGeometricState(tpf,false) where node is the parent of animation node but It doesn't work to.

How come ??

:frowning:

Hmm it should work.

Make sure you really call update and render from GameStateManager and also updating and rendering the GameTaskQueue.

Its easiest if you look in StandardGame or another Game* implementation to see whats needed.

One thing to take into account is:



Do not use the tpf value from FixedLogicrateGame.update(tpf), because this value will be always -1 in this Implementation.

Since FixedLogicrateGame.update() is called in fixed intervals you need to set your own value for updateGeometricstate().



FixedLogicrateGame's Game Loop:

            while (!finished && !display.isClosing()) {
                time1 = timer.getTime();
                loops = 0;

                while ((time1 - time0) > tickTime && loops < MAX_LOOPS) {
                    //handle input events prior to updating the scene
                    // - some applications may want to put this into update of the game state
                    InputSystem.update();

                    //update game state, do not use interpolation parameter
                    update(-1.0f);
                    time0 += tickTime;
                    loops++;
                }

                //If the game logic takes far too long, discard the pending
                // time
                if ((time1 - time0) > tickTime) time0 = time1 - tickTime;

                float percentWithinTick = Math.min(1.0f,
                        (float) (time1 - time0) / tickTime);
                //render scene with interpolation value
                render(percentWithinTick);

                //swap buffers
                display.getRenderer().displayBackBuffer();

                Thread.yield();
            }




edit:
thinking about it..  maybe FixedLogicrateGame should only expose an update method() without parameter ?
something like:


Index: src/com/jme/app/FixedLogicrateGame.java
===================================================================
RCS file: /cvs/jme/src/com/jme/app/FixedLogicrateGame.java,v
retrieving revision 1.16
diff -u -r1.16 FixedLogicrateGame.java
--- src/com/jme/app/FixedLogicrateGame.java   2 Aug 2007 21:36:19 -0000   1.16
+++ src/com/jme/app/FixedLogicrateGame.java   23 Feb 2008 20:14:26 -0000
@@ -175,8 +175,12 @@
      *            unused in this implementation
      * @see AbstractGame#update(float interpolation)
      */
-    protected abstract void update(float interpolation);
-
+    @Override
+    protected final void update(float interpolation) {
+        update();
+    }
+    protected abstract void update();
+   
     /**
      * Renders the scene. Under no circumstances should the render method alter
      * anything that could directly or indirectly modify the game logic.


That way, such mistakes could be prevented.