3D 세계에서 카메라를 움직이는 데 어려움을 겪고 있습니다. 두 가지보기 모드를 만들 것입니다.동일한 각도의 모델 뒤로 카메라를 이동하는 방법은 무엇입니까?
1 : fps (첫 사람) 용. 두 번째 : 문자 뒤의 외부보기 (두 번째 사람).
그물을 몇 가지 예제로 검색했지만 프로젝트에서 작동하지 않습니다. 여기
내 코드는 내가 당신이라면 F2가//Camera
double X1 = this.camera.PositionX;
double X2 = this.player.Position.X;
double Z1 = this.camera.PositionZ;
double Z2 = this.player.Position.Z;
//Verify that the user must not let the press F2
if (!this.camera.IsF2TurnedInBoucle)
{
// If the view mode is the second person
if (this.camera.ViewCamera_type == CameraSimples.ChangeView.SecondPerson)
{
this.camera.ViewCamera_type = CameraSimples.ChangeView.firstPerson;
//Calcul position - ?? Here my problem
double direction = Math.Atan2(X2 - X1, Z2 - Z1) * 180.0/3.14159265;
//Calcul angle - ?? Here my problem
this.camera.position = ..
this.camera.rotation = ..
this.camera.MouseRadian_LeftrightRot = (float)direction;
}
//IF mode view is first person
else
{
//....
감사합니다. –