Loading scene before animation starts

Hello,



I’ve created a big scene with blender and I have created one animation with MotinPath. The problem is now, that the animation has ended, before I can see something.



How do I make the scene load completely, before I can start the animation??



I have already tried the following, but it doesn’t work. Do somebody know a solution for my problem? I need a solution, where the animation starts automatically with the end of loading the scene. Thanks a lot.



[java]

motionTrack.setSpeed(0.0f);

player = (Node)assetManager.loadModel(“Models/Animation.scene”);

rootNode.attachChild(player);



try{

Thread.sleep(5000);

}catch(Exception e){}



motionTrack.setSpeed(1.0f);

[/java]

You are sleeping the render thread? :o



Thread.sleep() is generally a terrible idea in game programming.



Use an update() with a time comparison or something like a ScheduledExecutorService that then enques the command to start the animation.

Hey thank you for your answer. Yes that’s right, it was a terrible solution with thread.sleep, because it doesn’t work. hehe

But what do you mean with “use an update() with time camparison”.

How can I use that in my case?

This might help:

http://hub.jmonkeyengine.org/groups/general-2/forum/topic/multiple-fast-clicking/

hey, thank you very much for the reference!!! it’s working fine. It was all that I needed to solve the problem.

1 Like