Smeruxa
Известный
- 1,294
- 680
Оно возвращает не угол, а требует две координаты, а какие брать нужно?GAME->GetCamera()->GetCam(GAME->GetCamera()->GetActiveCam())->GetDirection()
Я такой код попробовал
C++:
CCam *camera = GAME->GetCamera()->GetCam(GAME->GetCamera()->GetActiveCam());
CVector camera_position = *camera->GetSource();
camera->GetDirection(camera_position.fX, camera_position.fY);
float angle = atan2(camera_position.fY, camera_position.fX);
PEDSELF->SetCurrentRotation(angle);
C++:
CCam* camera = GAME->GetCamera()->GetCam(GAME->GetCamera()->GetActiveCam());
CVector camera_position = *camera->GetSource();
CVector camera_last = *camera->GetTargetHistoryPos();
CVector new_vector = { camera_last.fX - camera_position.fX, camera_last.fY - camera_position.fY, camera_position.fZ};
float angle = atan2(new_vector.fY, new_vector.fX) + (90 * (PI / 180));
float new_angle = atan2(sin(angle), cos(angle));
PEDSELF->SetCurrentRotation(new_angle);
Последнее редактирование: