Add WoW-style camera system with collision and first-person mode

- Implement orbit camera with smooth zoom and collision detection
- Add 50° slope limiting with sliding (prevents mountain climbing)
- Add first-person mode that hides player model and weapons
- Add floor clearance check to prevent camera clipping through ground
- Improve WMO wall collision with proper height range checks
- Add two-sided floor collision detection for WMO geometry
- Increase M2 render distance slightly for better visibility
This commit is contained in:
Kelsi 2026-02-03 14:26:08 -08:00
parent 3e792af3e5
commit 54dc27c2ec
7 changed files with 307 additions and 64 deletions

View file

@ -978,6 +978,10 @@ void CharacterRenderer::render(const Camera& camera, const glm::mat4& view, cons
for (const auto& pair : instances) {
const auto& instance = pair.second;
// Skip invisible instances (e.g., player in first-person mode)
if (!instance.visible) continue;
const auto& gpuModel = models[instance.modelId];
// Set model matrix (use override for weapon instances)
@ -1118,6 +1122,21 @@ void CharacterRenderer::setActiveGeosets(uint32_t instanceId, const std::unorder
}
}
void CharacterRenderer::setInstanceVisible(uint32_t instanceId, bool visible) {
auto it = instances.find(instanceId);
if (it != instances.end()) {
it->second.visible = visible;
// Also hide/show attached weapons (for first-person mode)
for (const auto& wa : it->second.weaponAttachments) {
auto weapIt = instances.find(wa.weaponInstanceId);
if (weapIt != instances.end()) {
weapIt->second.visible = visible;
}
}
}
}
void CharacterRenderer::removeInstance(uint32_t instanceId) {
instances.erase(instanceId);
}