Jme3 Beginner: Jumping/Skipping animation to a certain time event

Hello,



I am have an animation adapter using Jme3 that reads a trace file and animates it. I am trying to implement a FFwd feature to jump to a certain line. For the record, I am using Advanced Cinematics for the animation.



So to summarize my code:



I have a function readFile(a,b) where a is the line to start animating and b the line to stop animating.



so in my main:



[java]

{

readFile(0 , 1.0f); // create all the objects on this thread

boolean fastForward = true;

double fastForwardBy = 1000.0f; // i want to jump (or FFWD by 1000 secs)

// FastForward Feature

if(fastForward(fastForward) == true)

{

//TODO implement event skipping via lines scanning

readFile(1000 , 2000.0f); <<<< now this doesn’t work I guess b/c the animation events are not connected, it stops right after 1sec

}

else // read the file normally from time 1.1f till the end of it.

{

/** Separate thread that reads the rest of the file concurrently with the execution */

final LoaderAppState loader = new LoaderAppState(); //Attach LoaderAppState

getStateManager().attach( loader );

loader.setEnabled(true);

}

}

[/java]



Is there any work around this problem???



One approach I though of was to fast forward until reaching time 1000 then play normal time (I think that’s how it’s done in most animation engines) something like that:



[java]

if(fastForward(fastForward) == true)

{

//speed up animation

cinematic.setSpeed(1000);

readFile(1.1f , 1000.0f); <<<< this time the animation gets faster then slows down w/o any events being skipped

cinematic.setSpeed(1); // bac to normal speed

}

[/java]

I guess you just need to call update on the AnimControl with a tpf as large as the time you want to skip.

and how do i do that?

@normen can you give me a hint?

oO What exactly did you do the last day and 20 hours? Refresh this page hoping I’d answer? When I say “call update on the AnimControl with a tpf as large as the time you want to skip” and theres a method called “controlUpdate” on the AnimControl… Isn’t trying to go animControl.controlUpdate(someValue); kind of obvious?

No Normen, I spent it trying to figure out where the AnimControl is located cz I don’t have that type of animation in my code. I use Eclipse plugin to run JME and not sure if that’s why but I never dealt with AnimControl. How do I get to that update function so I can skip in time. I am using Cinematics btw so not sure I can use that with Cinematics



I am not being lazy and relying on u if thats what u think, I just need more explanation to understand what to do.

@nehon are you thinking of implementing a similar feature for Cinematics? a feature to Fast Forward or even better jump to a specific time event?



If not , how hard would it be for me to implement such a feature, and could you give me a hint how to start?

Well its cinematic.update(someTime) then…

it doesn’t work I already tried it, nothing happens

I think the events need to be connected or something.



time 0 until time 1 all my objects are drawn/created. time 1 I want to skip till time 1000, if I do cinematic.update(1000); this will result in the objects being drawn and nothing after that. Animation just stops.

It’s complicated.

Also we’ll eventually need to be able to setTime() on a cinematic with the cinematic editor, so i’m gonna implement it.

Be patient though it’s not as simple as it looks.

1 Like

Great! how will I find out when it is implemented? anywhere to check?

why did I get a Thumbs down??



and does update() work in any condition?

@garnaout said:
Great! how will I find out when it is implemented? anywhere to check?

i'll report back here when it's done

@garnaout said:
why did I get a Thumbs down??

and does update() work in any condition?

Well you know this community thing is quite based on a fair help trade, and you can't deny you've been asking a lot without giving back much help.
My guess is that with the previous message you just crossed the line in someone's mind and he/she gave you that -1.
It's been some time that you are around so you must have gained some insight about JME that could benefit others in some way, i'm sure that if you make the effort of answering some questions around you'll get your thumb refunded in not time ;)

Fair enough… you are right, i’ll try helping out more from now on.



however note that although I’ve been here for 3-4 months now, I’ve been learning Java and JME in the process (in fact I am reading a beginner book of Java as recommended by @normen) , and many of the topics discussed are sometimes too advanced for me trying to help in. I do however give my opinion to topics I run across.



Thanks @nehon

@garnaout Sorry i totally forgot to update the post.



I worked on it this Week End and the cinematic has now a working setTime(float time) function.

the time parameter is the time in second. It does not take speed into account so if you have a 20 sec cinematic at speed 10 (during actually 2 sec) if you want to fast forward to the half of it you have to call setTime(10);



The MotionTrack and MotionPath has been a bit refactored (especially the way the position was interpolated). The API remains the same though, so you shouldn’t see any difference except that the speed of the spatial on the track is now a lot more constant.



please report any issue

I’ll update my jar files, give it a shot and let u know…



Thanks



I also asked you in a different post if there’s something wrong with the cinematic.setSpeed(). I think there’s a bug.



http://hub.jmonkeyengine.org/groups/general-2/forum/topic/jme3-cinemtics-speeding-up-the-animation/

did clean and build, did an eclipse:eclipse refresh, tried everything. I copied the jars the right way taking into consideration @Normen’s post.



The weird part that inside Eclipse Cinematics.class contains setTime, but for some reason it’s not being recognized by Eclipse.



Seems like it’s an Eclipse issue at this point.

1 Like

I am having the weirdest thing ever. I uploaded my jar files and I can see that Cinematic class contains setTime however Eclipse does not recognize it. I tried to restart, and recompile, but still cineamtic.setTime is not recognized although it is in Cinematic.



does anyone have any idea what might be the problem?

@garnaout said:
I also asked you in a different post if there's something wrong with the cinematic.setSpeed(). I think there's a bug.

http://hub.jmonkeyengine.org/groups/general-2/forum/topic/jme3-cinemtics-speeding-up-the-animation/

my answer in the thread

@garnaout said:
I am having the weirdest thing ever. I uploaded my jar files and I can see that Cinematic class contains setTime however Eclipse does not recognize it. I tried to restart, and recompile, but still cineamtic.setTime is not recognized although it is in Cinematic.

does anyone have any idea what might be the problem?

clean and build?
also there has been heavy changes in the structure of the distributed jars so this thread might be of interest
http://hub.jmonkeyengine.org/groups/development-discussion-jme3/forum/topic/library-and-source-cleanups-bye-bye-jmonkeyengine3-jar/