Time/frame based rotation

what i'm have: model and LocalRotation (Quaternion)

and point (Vector3f)

can somebody help me with whis?

i'm need animated rotation from model Quaternion to point with some time or some parts?

any help be greatiful.



PS mayme some body can remoned good library for 3d mathimatical? (vector angle, point distance and etc)

I'd copy Your base quaternion as start then compute  quaternion.lookAt() as end - rotation and then start.slerp(end, f) between the two.



also see: http://www.jmonkeyengine.com/wiki/doku.php?id=quaternion



hth

i'm try use Quaternions, but has some problem.

In this code i'm wont the model rotate to point  location (0,0,0)

now nothing happenes 0_0 i'm really confused.  can any help with this please?


    public void rotate(Spatial child, Vector3f location) {
        location = new Vector3f(0,0,0);
        SpatialTransformer transformer = new SpatialTransformer(1);
        transformer.setRepeatType(SpatialTransformer.RT_CLAMP);
        transformer.setObject(child,0,-1);
        transformer.setActive(true);

        Quaternion rotRef = new Quaternion();
        Quaternion endRot = new Quaternion();

        Quaternion startRot = child.getLocalRotation();
        endRot.lookAt(location,new Vector3f(1,1,1));

        child.addController(transformer);
        for (float i=0;i<=1.0;i=i+0.01f) {
            rotRef = startRot.slerp(startRot,endRot,i);
            transformer.setRotation(0,i,rotRef);
            transformer.interpolateMissing();
        }
    }

Have You looked at the jmetest's ?



theres a sample of lookAt in jmetest.renderer.TestSpatialLookAt  and for slerp in jmetest.renderer.TestOrientedBox



TestSpatialLookAt shows how to look at something

TestOrientedBox shows how to rotate over time



hth