XNA Creators Club Online
Page 1 of 1 (2 items)
Sort Posts: Previous Next

Can someone help me out please? Character model an camera position

Last post 05/07/2009 7:53 by Willshire86. 1 replies.
  • 05/07/2009 7:30

    Can someone help me out please? Character model an camera position

    So my current problem is my camera acts the way I want it too, but my character test model is doing it's own thing pretty much. The weird thing is though, my camera pasition and stuff is based on the position of my test model. Here is the parts of code I believe I am having issues with. Can someone please tell me where I am wrong here please?


                Matrix CharacterMoveRotationMatrix = Matrix.CreateRotationY(cameraYaw);
                Vector3 transformedCharacterReference = Vector3.Transform(CharacterReference, CharacterMoveRotationMatrix);
                CharacterPosition += Vector3.Transform(moveVector, CharacterMoveRotationMatrix);
                
                cameraPosition.X = CharacterPosition.X * 55f;
                cameraPosition.Y = CharacterPosition.Y + 10f;
                cameraPosition.Z = CharacterPosition.Z * 55f;
                cameraTarget = (CharacterPosition + Vector3.Transform(CharacterReference, (Matrix.CreateRotationX(cameraPitch) * Matrix.CreateRotationY(cameraYaw)))) * 55f;

    that or this part...


    foreach (ModelMesh mesh in Character.Meshes)
                {
                    foreach (BasicEffect effect in mesh.Effects)
                    {
                        effect.Projection = Projection;
                        effect.View = Matrix.CreateLookAt(cameraPosition, CharacterTarget, Vector3.Up);
                        effect.World = CharacterTrans[mesh.ParentBone.Index] *
                                        Matrix.CreateTranslation(CharacterPosition) *
                                        Matrix.CreateScale(55f);
                    }
                    mesh.Draw();
                }

  • 05/07/2009 7:53 In reply to

    Re: Can someone help me out please? Character model an camera position

    ha, solved the problem, I'm going to leave this up for a week and see if anyone can fix the problem. I'll tell you what's wrong in a week. think of it as a training exercise.
Page 1 of 1 (2 items) Previous Next
var gDomain='m.webtrends.com'; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/
DCSIMG