. right now i can get the camera to turn and follow my avatar from a fixed position easy just put the model position in cameratarget, I can also get the camera to stay behind the avatar at a fixed position but when it follows the model it doesn't turn with it. can i get some help here i can't figure out how to get the code to work so it follows the model and also turns with it so its always behind below is my code minus some of the unneeded code..

public class Game1 : Microsoft.Xna.Framework.Game

{

GraphicsDeviceManager graphics;

ContentManager content;

Model Happyface;

Model floor;

Vector3 cameraPosition = new Vector3(0.0f, 50.0f, 500.0f);

Vector3 cameraTarget = new Vector3(0.0f, 0.0f, 0.0f);

Vector3 cameraUp = Vector3.Up;

float Fov = MathHelper.ToRadians(45f);

float aspectRatio = 640.0f / 480.0f;

float nearClip = 1.0f;

float farClip = 500000.0f;

Vector3 cameraReference = new Vector3(0, 0, 10);

Vector3 avatarVelocity = Vector3.Zero;

float avatarRotation = 0.0f;

Vector3 avatarPosition = new Vector3(0.0f, 0.0f, 0.0f);

protected override void Update(GameTime gameTime)

{

// Allows the default game to exit on Xbox 360 and Windows

if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)

this.Exit();

UserInput(); ;

//didnt use this methods cause they dont turn the camera with the avatar

// camera change follows model but doesnt turn with it

//cameraChange();

avatarPosition += avatarVelocity;

avatarPosition *= .99f;

base.Update(gameTime);

}

protected void UserInput()

{

GamePadState currentState = GamePad.GetState(PlayerIndex.One);

if (currentState.IsConnected)

{

//rotate avatar

avatarRotation -= currentState.ThumbSticks.Left.X * 0.10f;

Vector3 avatarVelocityAdd = Vector3.Zero;

avatarVelocityAdd.X = -(float)Math.Sin(avatarRotation);

avatarVelocityAdd.Z = -(float)Math.Cos(avatarRotation);

avatarVelocityAdd *= currentState.Triggers.Right;

avatarVelocity += avatarVelocityAdd;

if (currentState.Buttons.A == ButtonState.Pressed)

{

avatarPosition = Vector3.Zero;

avatarVelocity = Vector3.Zero;

avatarRotation = 0.0f;

}

}

}

protected override void Draw(GameTime gameTime)

{

graphics.GraphicsDevice.Clear(Color.CornflowerBlue);

DrawModel(Happyface, avatarPosition, avatarRotation);

DrawModel(floor, Vector3.Zero, 90.0f);

base.Draw(gameTime);

}

/// <summary>

/// This is called when the game should draw itself.

/// </summary>

/// <param name="gameTime">Provides a snapshot of timing values.</param>

//dont use this but this will work if i figure out how to turn the camera still havent figured it //out yet so wont use it but it

//keeps camera right behind objectif only can turn my camera its third person mode.

protected void cameraChange()

{

Matrix rotationMatrix = Matrix.CreateRotationY(avatarRotation);

Vector3 transformedReference = Vector3.Transform(cameraReference, rotationMatrix);

cameraPosition = avatarPosition + transformedReference;

cameraPosition.X = avatarPosition.X - 500f;

cameraPosition.Z = avatarPosition.Z - 500f;

}

//didnt use this tried to but wont work

protected void CameraMOVING()

{

cameraPosition.X = (float)( Math.Cos(avatarRotation) * Math.Cos(avatarRotation));

cameraPosition.Y = (float)( Math.Sin(avatarRotation));

cameraPosition.Z = (float)(Math.Cos(avatarRotation) * Math.Sin(avatarRotation));

}

//draw a model anymodel just pass the model and attach there reference in solution //explorer

public void DrawModel(Model model, Vector3 Position, float Rotation)

{

Matrix[] transforms = new Matrix[model.Bones.Count];

model.CopyAbsoluteBoneTransformsTo(transforms);

foreach (ModelMesh mesh in model.Meshes)

{

foreach (BasicEffect effect in mesh.Effects)

{

effect.EnableDefaultLighting();

effect.World = transforms[mesh.ParentBone.Index] * Matrix.CreateRotationY(Rotation) * Matrix.CreateTranslation(Position);

UpdateCamera(effect);

}

mesh.Draw();

}

}

//chaanges the camera positions

protected void UpdateCamera(BasicEffect effect)

{

effect.View = Matrix.CreateLookAt(cameraPosition,avatarPosition, cameraUp);

effect.Projection = Matrix.CreatePerspectiveFieldOfView(Fov, aspectRatio, nearClip, farClip);

}

}

}

.thanks for the help guys