Animation question

Hallo!



I have my two boxes.

Now I want to have a sphere walking from one box to another.

What is the best way to implement this?

your gonna wanna use a spartial transformer i'll give you an example too



SpatialTransformer st = new SpatialTransformer(numObj);
st.setObject(Sphere s,0,-1);
st.setPosition(0,time,box.getLocalTransform());
st.setPosition(0,time,box1.getLocalTransform());


you'll probly wanna use getWorldTranslation() i was just giving an example

I have done now the following:

But the sphere does not move a pixel!

What could be wrong?



public void simpleSetup() {
        System.out.println("Setup called");
        Box b = new Box("Mybox1", new Vector3f(-0.5f, -0.5f, -0.5f), new Vector3f(0.5f, 0.5f, 0.5f));
       
        b.setLocalTranslation(new Vector3f(10,0,0));
       
        rootNode.attachChild(b); // Put it in the scene graph
       
        Box b2 = new Box("Mybox2", new Vector3f(-0.5f, -0.5f, -0.5f), new Vector3f(0.5f, 0.5f, 0.5f));
       
        b2.setLocalTranslation(new Vector3f(-10,0,0));
       
        rootNode.attachChild(b2); // Put it in the scene graph
       
        Line line=new Line("Line", new Vector3f[]{b.getLocalTranslation(),b2.getLocalTranslation()},null,null,null);
        rootNode.attachChild(line);
       
       
        millisLastFrame=System.currentTimeMillis();
       
       
        sphere=new Sphere("My Sphere",30,30,0.5f);
        rootNode.attachChild(sphere);
       
        SpatialTransformer st = new SpatialTransformer(1);
        //st.setObject(sphere,0,-1);
        st.setObject(sphere,0,-1);
        st.setPosition(0,this.timer.getTime(),b.getWorldTranslation());
        st.setPosition(0,this.timer.getTime()+1000,b2.getWorldTranslation());
        st.interpolateMissing();      
 
       
    }

you need to add the controller to the sphere as well (sphere.addcontroller(st))

sorry left that out you might have looked in the javadoc before posting next time. just a thought

i suggest allways going through the TestXXX classes, there are samples of almost every usage there…including SpatialTransformer…