I have written a program to record the x,y,z coordinated of the Hand joint and I want to animate my models 2D or 3D according to these coordinates. . .However the output of the x,y,z coordinates are fluctuating from -0 to 1 but not more than that..
So i assume I will need to multiply them back with the screen width and height, however it still doesnt seem to animate according to the original x,y,z points
Any transformations I might be missing out?
protected override void Update(GameTime gameTime)
{
position += spriteSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
//// TODO: Add your update logic here
using (StreamReader r = new StreamReader(f))
{
string line;
Viewport view = graphics.GraphicsDevice.Viewport;
int maxWidth = view.Width;
int maxHeight = view.Height;
// int i = 0;
while ((line = r.ReadLine()) != null)
{
string[] temp = line.Split(',');
int x = (int) Math.Floor((float.Parse(temp[0]) * 0.5f) + 0.5f) maxWidth);
int y = (int) Math.Floor((float.Parse(temp[1]) * -0.5f) + 0.5f) * maxHeight);
motion.Add(new Point(x, y));
// Console.WriteLine(temp[0] + "," + temp[1] + "," + motion[i].X+ "," + motion[i].Y);
// i++;
}
}
// foreach (Point s in motion)
{
position.X = motion[i].X;
position.Y = motion[i].Y;
}
//
i++;
a_butterfly_up.Update(gameTime);
a_butterfly_side.Update(gameTime);
G_vidPlayer.Play(mossV);
base.Update(gameTime);
}