mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-14 23:28:27 +02:00
fall when flying not allowed
This commit is contained in:
parent
75c1bdbf0d
commit
5553752d81
1 changed files with 2 additions and 4 deletions
|
@ -672,7 +672,7 @@ void CharacterController::updateState() {
|
|||
return;
|
||||
}
|
||||
if (_pendingFlags & PENDING_FLAG_RECOMPUTE_FLYING) {
|
||||
SET_STATE(CharacterController::State::Hover, "recomputeFlying");
|
||||
SET_STATE(CharacterController::State::Hover, "recomputeFlying");
|
||||
_hasSupport = false;
|
||||
_stepHeight = _minStepHeight; // clears memory of last step obstacle
|
||||
_pendingFlags &= ~PENDING_FLAG_RECOMPUTE_FLYING;
|
||||
|
@ -784,15 +784,13 @@ void CharacterController::updateState() {
|
|||
// Transition to hover if we are above the fall threshold
|
||||
SET_STATE(State::Hover, "above fall threshold");
|
||||
}
|
||||
} else if (!rayHasHit && !_hasSupport) {
|
||||
SET_STATE(State::Hover, "no ground detected");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case State::Hover:
|
||||
btScalar horizontalSpeed = (velocity - velocity.dot(_currentUp) * _currentUp).length();
|
||||
bool flyingFast = horizontalSpeed > (MAX_WALKING_SPEED * 0.75f);
|
||||
if (!_flyingAllowed && rayHasHit) {
|
||||
if (!_flyingAllowed) {
|
||||
SET_STATE(State::InAir, "flying not allowed");
|
||||
} else if ((_floorDistance < MIN_HOVER_HEIGHT) && !jumpButtonHeld && !flyingFast) {
|
||||
SET_STATE(State::InAir, "near ground");
|
||||
|
|
Loading…
Reference in a new issue