mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-25 08:30:13 +00:00
Optimize collision further: skip when stationary, cache floor height, fix drop bug
- Skip wall collision sweep entirely when player isn't moving (saves all collision calls when standing still) - Reduce max sweep steps from 4 to 2 with 1.0f step size (all paths: follow, free-fly, swimming) - Cache floor height between frames, reuse when position changes <0.5 units - Fix floor height not updating after walking off tall objects (fountain etc) by always smoothing toward detected ground instead of ignoring drops >2 units - Reduce free-fly ground probes from 5 to 1 - Disable WMO camera collision (raycast + floor probes) for performance - Add spatial grid to raycastBoundingBoxes for when camera collision is re-enabled
This commit is contained in:
parent
974384c725
commit
6516fd777d
3 changed files with 110 additions and 118 deletions
|
|
@ -4,6 +4,7 @@
|
|||
#include "core/input.hpp"
|
||||
#include <SDL2/SDL.h>
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
|
||||
namespace wowee {
|
||||
namespace rendering {
|
||||
|
|
@ -133,6 +134,10 @@ private:
|
|||
static constexpr float JUMP_BUFFER_TIME = 0.15f; // 150ms input buffer
|
||||
static constexpr float COYOTE_TIME = 0.10f; // 100ms grace after leaving ground
|
||||
|
||||
// Cached floor height between frames (skip expensive probes when barely moving)
|
||||
std::optional<float> cachedFloorHeight;
|
||||
glm::vec2 cachedFloorPos = glm::vec2(0.0f);
|
||||
|
||||
// Cached isInsideWMO result (throttled to avoid per-frame cost)
|
||||
bool cachedInsideWMO = false;
|
||||
int insideWMOCheckCounter = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue