mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Disable WMO/M2 camera collision raycasts
Camera collision with WMO walls and M2 doodads caused erratic zoom and pull-through at doorway transitions. Terrain-only camera floor clamping is retained.
This commit is contained in:
parent
64879b8aab
commit
401cb6928c
1 changed files with 2 additions and 22 deletions
|
|
@ -1272,28 +1272,8 @@ void CameraController::update(float deltaTime) {
|
||||||
// Find max safe distance using raycast + sphere radius
|
// Find max safe distance using raycast + sphere radius
|
||||||
collisionDistance = currentDistance;
|
collisionDistance = currentDistance;
|
||||||
|
|
||||||
// WMO raycast collision: zoom in when camera would clip through walls/floors
|
// WMO/M2 camera collision disabled — was pulling camera through
|
||||||
if (wmoRenderer && currentDistance > MIN_DISTANCE) {
|
// geometry at doorway transitions and causing erratic zoom behaviour.
|
||||||
glm::vec3 camRayOrigin = pivot;
|
|
||||||
glm::vec3 camRayDir = camDir;
|
|
||||||
float wmoHitDist = wmoRenderer->raycastBoundingBoxes(camRayOrigin, camRayDir, currentDistance);
|
|
||||||
if (wmoHitDist < currentDistance) {
|
|
||||||
// Hit WMO geometry — pull camera in to avoid clipping
|
|
||||||
constexpr float CAM_RADIUS = 0.3f;
|
|
||||||
collisionDistance = std::max(MIN_DISTANCE, wmoHitDist - CAM_RADIUS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// M2 raycast collision: zoom in when camera would clip through doodads
|
|
||||||
if (m2Renderer && !externalFollow_ && currentDistance > MIN_DISTANCE) {
|
|
||||||
glm::vec3 camRayOrigin = pivot;
|
|
||||||
glm::vec3 camRayDir = camDir;
|
|
||||||
float m2HitDist = m2Renderer->raycastBoundingBoxes(camRayOrigin, camRayDir, currentDistance);
|
|
||||||
if (m2HitDist < collisionDistance) {
|
|
||||||
constexpr float CAM_RADIUS = 0.3f;
|
|
||||||
collisionDistance = std::max(MIN_DISTANCE, m2HitDist - CAM_RADIUS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Camera collision: terrain-only floor clamping
|
// Camera collision: terrain-only floor clamping
|
||||||
auto getTerrainFloorAt = [&](float x, float y) -> std::optional<float> {
|
auto getTerrainFloorAt = [&](float x, float y) -> std::optional<float> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue