これは、オブジェクトをマウスで移動させる私のコードですが、画面 (カメラ) は一緒に移動しません。なぜそれをしているのかわかりません。誰でも理由を理解できますか??
void UpdateCamera()
{
currentmousestate = Mouse.GetState();
// Calculate the camera's current position.
Vector3 cameraPosition = avatarPosition;
Matrix rotationMatrix = Matrix.CreateRotationY(avatarYaw);
// Create a vector pointing the direction the camera is facing.
// Compare the original mouse position with the new one,
// and divide that by a float of -80.
cameraReference = new Vector3((currentmousestate.X - originalstate.X)/-80f, (currentmousestate.Y - originalstate.Y)/-80f, 1);
avatarYaw = (float)(currentmousestate.X - originalstate.X)/-160f;
Vector3 transformedReference = Vector3.Transform(cameraReference, rotationMatrix);
// Calculate the position the camera is looking at.
Vector3 cameraLookat = cameraPosition + transformedReference;
// Set up the view matrix and projection matrix.
view = Matrix.CreateLookAt(cameraPosition, cameraLookat, new Vector3(0.0f, 1.0f, 0.0f));
Viewport viewport = graphics.GraphicsDevice.Viewport;
float aspectRatio = (float)viewport.Width / (float)viewport.Height;
proj = Matrix.CreatePerspectiveFieldOfView(viewAngle, aspectRatio, nearClip, farClip);
//originalstate = currentmousestate;
}