# Three JS and Ammo JS - Rotate kinematic sphere

I’m trying to rotate a kinematic sphere created with Ammo JS and Three JS, I succeed to move the sphere but my sphere doesn’t rotate to the moving direction. This is my function to update the sphere position :

``````function updateBallPosition() {

let scalingFactor = startVelocity;

let translateFactor = tmpPos.set(ballObject.move.x, ballObject.move.y, ballObject.move.z);

translateFactor.multiplyScalar(scalingFactor);

ballObject.translateX(translateFactor.x);

ballObject.translateY(translateFactor.y);

ballObject.translateZ(translateFactor.z);

ballObject.getWorldPosition(tmpPos);

ballObject.getWorldQuaternion(tmpQuat);

let physicsBody = ballObject.userData.physicsBody;

let ms = physicsBody.getMotionState();

if ( ms ) {

ammoTmpPos.setValue(tmpPos.x, tmpPos.y, tmpPos.z);

ammoTmpQuat.setValue( tmpQuat.x, tmpQuat.y, tmpQuat.z, tmpQuat.w);

tmpTrans.setIdentity();

tmpTrans.setOrigin( ammoTmpPos );

tmpTrans.setRotation( ammoTmpQuat );

ms.setWorldTransform(tmpTrans);

}

//  let angVel = physicsBody.getAngularVelocity();

//  physicsBody.setAngularVelocity( new Ammo.btVector3( angVel.x, angVel.y, angVel.z ));

}
``````

How can I rotate my sphere to the moving direction ?

Have you tried a ammo.js wrapper like enable3d?

In this example the kinematic cube rotates only by coding:

``````const animate = () => {
cube.rotation.x += 0.01
cube.rotation.y += 0.01
cube.body.needUpdate = true // this is how you update kinematic bodies
...
``````