Like this article? We recommend
Getting the Objects from the World
The world is loaded; now you have to get the objects from the world (see Listing 2). This time the world has four objects, and one of them is the information about the animation (the kangaroo is hopping). You can get the objects by using the find() method of the World.
Listing 2. Getting the objects from the world
try { tRoo = (Group) myWorld.find(POGOROO); tCams = (Group) myWorld.find(CAMERA); acRoo = (Group) myWorld.find(TRANSFORM); animRoo = (AnimationController) myWorld.find(ROO); // get length of animation AnimationTrack track = acRoo.getAnimationTrack(0); animLength = 1000; // default length, 1 second if (track != null) { KeyframeSequence ks = track.getKeyframeSequence(); if (ks != null) animLength = ks.getDuration(); } } catch(Exception e) { e.printStackTrace(); }