내 게임에서 카메라를 회전하는 데 사용할 수있는 변수 나 방법이 있는지 궁금합니다. xyz 축을 따라 이동할 수 있지만 그것을 회전하는 방법을 알아낼 수 없습니다! : O 여기 카메라를 회전하는 방법 - 카메라 회전
은 변수입니다
Model spaceShip;
float aspectRatio;
Vector3 modelPosition = Vector3.Zero;
float modelRotation = 0f;
Vector3 cameraPosition = new Vector3(0f, 50f, 5000f);
여기
얼마나 그 연신 (모델 (우주선))
Matrix[] transforms = new Matrix[spaceShip.Bones.Count];
spaceShip.CopyAbsoluteBoneTransformsTo(transforms);
foreach (ModelMesh mesh in spaceShip.Meshes)
{
foreach (BasicEffect effect in mesh.Effects)
{
effect.EnableDefaultLighting();
effect.World = transforms[mesh.ParentBone.Index] * Matrix.CreateRotationY(this.modelRotation) * Matrix.CreateTranslation(this.modelPosition);
effect.View = Matrix.CreateLookAt(this.cameraPosition, Vector3.Zero, Vector3.Up);
effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45f), aspectRatio, 1f,200000f);
}
mesh.Draw();
}
및 이 종횡비는 다음에로드됩니다 :
aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;
의 가능한 중복 : HTTP ://stackoverflow.com/questions/5906907/xna-rotate-camera-around-its-createlookat-target 또한이 샘플을보십시오. http://msdn.microsoft.com/en-us/library/bb197901.aspx – surfen