0
어떻게 대상 카메라를 변경합니까?카메라에 따라 XNA 4.0 C#
대상 :
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Flight
{
public class FollowCamera : CCamera
{
public Vector3 Target { get; set; }
public FollowCamera(Vector3 Position, Vector3 Target,
GraphicsDevice graphicsDevice)
: base(graphicsDevice)
{
this.Position = Position;
this.Target = Target;
}
public override void Update()
{
//Missing lines of code used to determine
//the up vector
Vector3 forward = Target - Position;
Vector3 right = Vector3.Cross(forward, Vector3.Up);
Vector3 up = Vector3.Cross(right, forward);
this.View = Matrix.CreateLookAt(Position,
Target, up);
}
}
}
나는 약간의 수정과 코드 줄을 사용 플러스에 대상 뒤에해야 얼마나 멀리 카메라 길이를 추가 할 수있는 단서가 않습니다. 이 코드는 카메라를 우주선과 함께 움직일 수있게 해줄 필요가 있습니다. 도와주세요
this.local = Matrix.CreateFromYawPitchRoll(orientation.Y, orientation.X, orientation.Z) * Matrix.CreateTranslation(position.X, position.Y, position.Z) * this.local;