Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const float Pitch_Factor = 90.0f / 16000.0f; //теперь при выводе, умнож питч на эту хрень. И яв на ниэнюю. Что выведет
- const float Yaw_Factor = 180.0f / 32768.0f;
- const float AIMPitch_Factor = 16000.0f / 90.0f; //Так? да.
- const float AIMYaw_Factor = 32768.0f / 180.0f;
- D3DXVECTOR3 vpos = { actor->PlayerCamera->Location.X, actor->PlayerCamera->Location.Y, actor->PlayerCamera->Location.Z };
- static float posTest[3];
- if (GetAsyncKeyState(VK_F1) & 0x8000)
- {
- posTest[0] = actor->PlayerCamera->Location.X;
- posTest[1] = actor->PlayerCamera->Location.Y;
- posTest[2] = actor->PlayerCamera->Location.Z;
- };
- float pitch = (float)actor->Pawn->Owner->Rotation.Pitch * Pitch_Factor;
- float yaw = (float)actor->Pawn->Owner->Rotation.Yaw * Yaw_Factor;
- float aim_yaw = BMATH::XAngle(vpos[0], vpos[1], posTest[0], posTest[1], yaw);
- float aim_pitch = BMATH::YAngle(vpos[0], vpos[1], vpos[2], posTest[0], posTest[1], posTest[2], pitch);
- sprintf(str, "yaw: %f pitch: %f\naim_yaw: %f aim_pitch: %f", yaw, pitch, aim_yaw, aim_pitch);
- BGUI::Text.DrawEx(str, 0, 20, 40, BGUI::color_gold, 0, 0, 0, 1, *BGUI::color_black);
- D3DXMATRIX mproj;
- mproj = *Matrix->ViewState()->GetViewMatrix() * *Matrix->ViewState()->GetProjMatrix();
- float w[2];
- BOOL FOV = BMATH::DXProection(w, posTest, &mproj, BGUI::viewport.Width, BGUI::viewport.Height, 0, 1);
- if (FOV)
- {
- BGUI::DrawTexture(0, 0, w[0] - 10, w[1] - 10, 20, 20, BGUI::color_gold);
- }
- D3DXVECTOR3 Screen;
- bool AIMFOV = WorldToScreen((D3DXVECTOR3*)&posTest, (D3DXVECTOR3*)&Screen, *device, Matrix->ViewState()->GetProjMatrix(), Matrix->ViewState()->GetViewMatrix());
- if (AIMFOV)
- {
- BGUI::DrawTexture(0, 0, Screen.x - 10, Screen.y - 10, 20, 20, BGUI::color_gold);
- }
- if(GetAsyncKeyState(VK_NUMPAD1)&0x8000)actor->Pawn->Owner->Rotation.Yaw += (int)(0.5*aim_yaw * AIMYaw_Factor);
- if(GetAsyncKeyState(VK_NUMPAD2) & 0x8000)actor->Pawn->Owner->Rotation.Pitch += (int)(0.5*aim_pitch* AIMPitch_Factor);
- if (GetKeyState(VK_NUMPAD3))
- {
- actor->Pawn->Owner->Rotation.Yaw += (int)(0.5*aim_yaw * AIMYaw_Factor);
- actor->Pawn->Owner->Rotation.Pitch += (int)(0.5*aim_pitch* AIMPitch_Factor);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement