Using libgdx I need to move back and forth by a very small amount a soldier head:
I do the following: But the soldier head is flying up into the y axis out of the screen:
***Note:*** rockingfactor is either -0.005f or 0.005 in every call
Vector3 vectory = new Vector3();
hapsonSoldierReference.transform.getTranslation(vectory);
vectory.z+=deltaTime*rockinFactor;
/* Matrix4 transform = new Matrix4();
transform.set(hapsonSoldierReference.transform);
transform.translate(vectory);*/
// hapsonSoldierReference.transform.set(transform);
hapsonSoldierReference.transform.translate(vectory);
How can I fix this flying off the screen(y direction) problem!