Hi,
This is my first post in the forum. I am trying to use SpatialTransform to translate an object from one place to the next. However, I would like to be able to see the movement on the screen. I have looked at the testSpatialTransform, but I am rather lost with the for loop.
private void setTranslation()
{
Vector3f transRef = new Vector3f();
float translation;
//iterate over the range, go over by one step to accommodate mathematical error
for(float timeElp=0;timeElp<(this.time+(this.time/this.timeDivision));timeElp+=(this.time/this.timeDivision))
{
translation = (float)((timeElp/this.time)*(Math.PI*2));
//correct for mathematical errors
if(translation>(Math.PI*2))
translation=(float)Math.PI*2;
transRef.x = (float)(translation)*2;
transRef.y = (float)(translation)*2;
transRef.z = (float) (translation)*2;
/* transRef.x = (float)Math.sin(translation)*5;
transRef.y = (float)Math.cos(translation)*2.5f;
transRef.z = (float)Math.cos(translation)*5;
*/
//this.spt.setPosition(0,time,transRef);
this.spt.setPosition(0,timeElp,transRef);
}
/* transRef.x = (float) 2;
transRef.y = (float) 2;
transRef.z = (float) 2;
this.spt.setPosition(0,time,transRef);
*/
}
When I use the following:
transRef.x = (float) 2;
transRef.y = (float) 2;
transRef.z = (float) 2;
this.spt.setPosition(0,time,transRef);
The box is moved into that position at start up without showing the animation. I had the following assumptions.
setPosition(int indexInST, float time, Vector3f position)
Sets object with index indexInST to translate by position at time time.
means the following:
Translate the object 0 to the position in the time indicated. Or do we have to do it manually?
Thanks.