MCPcopy Create free account
hub / github.com/OpenNFS/OpenNFS / calculateCameraPosition

Method calculateCameraPosition

src/Scene/Camera.cpp:81–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81void 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
90void Camera::calculateZoom() {
91 float zoomLevel = ImGui::GetIO().MouseWheel * 0.1f;

Callers

nothing calls this directly

Calls 1

getRotYMethod · 0.80

Tested by

no test coverage detected