| 79 | } |
| 80 | |
| 81 | void Camera::calculateCameraPosition(const shared_ptr<Car> &target_car, float horizDistance, float vertDistance) { |
| 82 | float theta = (target_car->getRotY() + angleAroundCar) - 180; |
| 83 | float offsetX = horizDistance * sin(glm::radians(theta)); |
| 84 | float offsetZ = horizDistance * cos(glm::radians(theta)); |
| 85 | position.x = target_car->car_body_model.position.x - offsetX; |
| 86 | position.z = target_car->car_body_model.position.z - offsetZ; |
| 87 | position.y = target_car->car_body_model.position.y + vertDistance; |
| 88 | } |
| 89 | |
| 90 | void Camera::calculateZoom() { |
| 91 | float zoomLevel = ImGui::GetIO().MouseWheel * 0.1f; |