Problem understanding "time"in animations

I've got two questions regarding the time in animations, especially

in the tutorial "HelloAnimation".



http://www.jmonkeyengine.com/wiki/doku.php?id=starter:hello_animation



I've rewritten this tutorial to use several objects (to experiment with

several objects and their rotations/movements)



If every object is controlled by different SpatialTransformers (every

objects gets its own transformer), the whole animation

is significantly slower than i use ONE SpatialTransformer for ALL objects (via

the index parameter of the SpatialTransformer).



Simple Question: Why??



In the first case, getCurTime() of the SpatialTranformer seems to deliver

somehwat like "a second of the timer is a second in "real time"

… but not in the second case… (much shorter)



Thanks in advance…

… well, my problem must be more difficult than thought…  :wink:



…or my explanation is too weird…



Well, i think i know now WHY this happens, but I'm not sure if this behaviour is intended.



If you got several Spatials (Spheres, Boxes… whatever) and you assign them to ONE

SpatialController, every Spatial calls his method "updateWorldData(…)"



Therefore "update(…)" of SpatialController will be called for EVERY Spatial.



If they share the same Spatial controller, "curTime" of SpatialController gets incremented

"x"-times faster than a separate SpatialController <-> Spatial setup, with "x" being

the number of Spatials assigned to one SpatialController.



So again… Is this behaviour intended??



What's the use of the possibility of multiple Spatials within a SpatialController

if this is intended? (Maybe for actions which are not time-dependant?)



Thanks in advance!

I was just having the exact same problem.



I'm sure this will break something down the road, but I just assigned the controller to only one of the Spatials I want to transform.  It seems to still animate everything just fine, and it goes the right speed as well.

Yes, with a 1 : 1 relationship (SpatialTransformer:Spatial), we wouldn't have a problem… But shouldn't it work

with just one SpatialTransformer and multiple Spatials??



So the question… again: Is this behaviour intended?



I thought SpatialTransformers would be something fundamental… so I'm quite surprised

of the low amount of feedback for this question…  :?


A controller is usually assigned to only one spatial. If not it has to take care for the correct time itself - which SpatialTransformer does not do.

irrisor said:

A controller is usually assigned to only one spatial. If not it has to take care for the correct time itself - which SpatialTransformer does not do.


Well, THIS is an answer..  :D

I figured that out myself, but i think this should be somewhere in the javadocs... Maybe in the constructor
of SpatialTransformer, something like:

@param numObjects
    *            The number of spatials to change
                  Note, that you've got to take care of correct timings in animations yourself, if numObjects > 0


Would it be okay if i would add that information in the tutorial regarding animations with SpatialTransformers?
http://www.jmonkeyengine.com/wiki/doku.php?id=starter:hello_animation

You can still use more than one object. All you have to take care for is that you register the SpatialTransformer only once as a controller (e.g. at the rootnode or at the first spatial which is animated).

irrisor said:

You can still use more than one object. All you have to take care for is that you register the SpatialTransformer only once as a controller (e.g. at the rootnode or at the first spatial which is animated).


AHHHHHHHHHHHH!!!!  :D

(Imagine a giant lightbulb above my head now...)

Well... It think this IS worth to mention in the docs... Maybe in
"addController(Controller controller)" of the Spatial class?

Thanks a lot!!!

hmm, not sure about that, but surely in the tutorial

Well, i added these informations in the tutorial, but with me being a newbie it would be nice

if someone would look that over:



Modified paragraph:

SpatialTransformer extends Controller. Controllers

oliver1974 said:

<snip> ...

The -1 at the end of setObject is a parent index. Don
Gentleman Hal said:

oliver1974 said:

<snip> ...

The -1 at the end of setObject is a parent index. Don
oliver1974 said:

About telling somebody "just to do something..".. Well, I agree that's problematical to mention the problem
with one SpatialTransformer and multiple animated objects in THIS tutorial, but it took me HOURS to figure
this out (... "irrisor" gave me the decisive hint), and i think it should be mentioned SOMEWHERE.


I'm not saying it doesn't belong in the tutorial, infact I'm saying the exact opposite.  The reason why you should only add the controller once should be added to the tutorial as well.  That is we should go into detail here.

As for the English being a little funky I hope you didn't take that offensively as that wasn't my intention (it appears you didn't from your post :)).  It's kind of hard to explain, the sentences just don't "flow" correctly.  It's like when you have to read something twice to really take in what it's saying.  I'd like to point out now I'm by no means particularly good at English  :P


As for the English being a little funky I hope you didn't take that offensively as that wasn't my intention (it appears you didn't from your post :)).


No, not at all!  :)


It's kind of hard to explain, the sentences just don't "flow" correctly.  It's like when you have to read something twice to really take in what it's saying.  I'd like to point out now I'm by no means particularly good at English  :P


Well, i'm always happy if someone helps me to improve my english.. So, what's the correct.. ehh..." flow"  :D
(Yes, I know, it get's offtopic...)