From 825c398e548382de30ed7688470c6464462f476c Mon Sep 17 00:00:00 2001 From: ksuprynowicz Date: Sun, 19 Nov 2023 17:39:10 +0100 Subject: [PATCH] Changed gravity constant --- interface/src/avatar/MyAvatar.cpp | 6 +++--- interface/src/avatar/MyAvatar.h | 2 +- libraries/physics/src/CharacterController.cpp | 3 ++- libraries/shared/src/AvatarConstants.h | 7 ++++--- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 58c86e5e8a..827388aa1c 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -2806,8 +2806,8 @@ controller::Pose MyAvatar::getControllerPoseInAvatarFrame(controller::Action act void MyAvatar::updateMotors() { _characterController.clearMotors(); - const float FLYING_MOTOR_TIMESCALE = 0.0002f; // Originally 0.05f; - const float WALKING_MOTOR_TIMESCALE = 0.0002f; // Originally 0.2f; + const float FLYING_MOTOR_TIMESCALE = 0.002f; // Originally 0.05f; + const float WALKING_MOTOR_TIMESCALE = 0.1f; // Originally 0.2f; const float INVALID_MOTOR_TIMESCALE = 1.0e6f; float horizontalMotorTimescale; @@ -4091,7 +4091,7 @@ void MyAvatar::updateActionMotor(float deltaTime) { float finalMaxMotorSpeed = sensorToWorldScale * DEFAULT_AVATAR_MAX_FLYING_SPEED * _walkSpeedScalar; float speedGrowthTimescale = 2.0f; float speedIncreaseFactor = 1.8f * _walkSpeedScalar; - motorSpeed *= 1.0f + glm::pow(glm::clamp(deltaTime / speedGrowthTimescale, 0.0f, 1.0f), 0.7f) * speedIncreaseFactor; + motorSpeed *= 1.0f + glm::pow(glm::clamp(deltaTime / speedGrowthTimescale, 0.0f, 1.0f), 0.85f) * speedIncreaseFactor; // use feedback from CharacterController to prevent tunneling under high motorspeed motorSpeed *= _characterController.getCollisionBrakeAttenuationFactor(); const float maxBoostSpeed = sensorToWorldScale * MAX_BOOST_SPEED; diff --git a/interface/src/avatar/MyAvatar.h b/interface/src/avatar/MyAvatar.h index e0653a86ba..5e0627360c 100644 --- a/interface/src/avatar/MyAvatar.h +++ b/interface/src/avatar/MyAvatar.h @@ -2849,7 +2849,7 @@ private: ThreadSafeValueCache _prefOverrideAnimGraphUrl; QUrl _fstAnimGraphOverrideUrl; bool _useSnapTurn { true }; - bool _hoverWhenUnsupported{ true }; + bool _hoverWhenUnsupported{ false }; ThreadSafeValueCache _dominantHand { DOMINANT_RIGHT_HAND }; ThreadSafeValueCache _hmdAvatarAlignmentType { DEFAULT_HMD_AVATAR_ALIGNMENT_TYPE }; ThreadSafeValueCache _strafeEnabled{ DEFAULT_STRAFE_ENABLED }; diff --git a/libraries/physics/src/CharacterController.cpp b/libraries/physics/src/CharacterController.cpp index 78a3072023..4beeb5b22f 100644 --- a/libraries/physics/src/CharacterController.cpp +++ b/libraries/physics/src/CharacterController.cpp @@ -927,9 +927,10 @@ void CharacterController::updateState() { const btScalar FLY_TO_GROUND_THRESHOLD = 0.1f * _radius; const btScalar GROUND_TO_FLY_THRESHOLD = 0.8f * _radius + _halfHeight; + // TODO: This could be a setting. With 5 ms jumping feels very responsive, but with 250 ms animation looks nicer const quint64 TAKE_OFF_TO_IN_AIR_PERIOD = 5 * MSECS_PER_SECOND; // Originally 250 ms const btScalar MIN_HOVER_HEIGHT = _scaleFactor * DEFAULT_AVATAR_MIN_HOVER_HEIGHT; - const quint64 JUMP_TO_HOVER_PERIOD = _scaleFactor < 1.0f ? _scaleFactor * 350 * MSECS_PER_SECOND : 350 * MSECS_PER_SECOND; // Originally 1100 ms + const quint64 JUMP_TO_HOVER_PERIOD = _scaleFactor < 1.0f ? _scaleFactor * 500 * MSECS_PER_SECOND : 500 * MSECS_PER_SECOND; // Originally 1100 ms // scan for distant floor // rayStart is at center of bottom sphere diff --git a/libraries/shared/src/AvatarConstants.h b/libraries/shared/src/AvatarConstants.h index a25142b2ad..2f30341cc3 100644 --- a/libraries/shared/src/AvatarConstants.h +++ b/libraries/shared/src/AvatarConstants.h @@ -89,13 +89,14 @@ const float ANALOG_PLUS_AVATAR_MAX_WALKING_BACKWARD_SPEED = 2.42f; // meters / s const float ANALOG_PLUS_AVATAR_MAX_FLYING_SPEED = 30.0f; // meters / second const float ANALOG_PLUS_AVATAR_MAX_SPRINT_SPEED = 20.0f; // meters / second -const float DEFAULT_AVATAR_GRAVITY = -5.0f; // meters / second^2 (world) -const float DEFAULT_AVATAR_JUMP_SPEED = 3.5f; // meters / second (sensor) +const float DEFAULT_AVATAR_GRAVITY = -9.8f; // meters / second^2 (world) (originally -5.0f) +const float DEFAULT_AVATAR_JUMP_SPEED = 5.0f; // meters / second (sensor) (originally 3.5f) const float DEFAULT_AVATAR_JUMP_HEIGHT = (DEFAULT_AVATAR_JUMP_SPEED * DEFAULT_AVATAR_JUMP_SPEED) / (2.0f * -DEFAULT_AVATAR_GRAVITY); // meters (sensor) const float DEFAULT_AVATAR_MIN_JUMP_HEIGHT = 0.25f; // meters (world) // hack const float DEFAULT_AVATAR_FALL_HEIGHT = 20.0f; // meters -const float DEFAULT_AVATAR_MIN_HOVER_HEIGHT = 2.5f; // meters +const float DEFAULT_AVATAR_MIN_HOVER_HEIGHT = 0.35f; // meters, normally it was 2.5f +//const float DEFAULT_AVATAR_MIN_HOVER_HEIGHT = 2.5f; // meters, normally it was 2.5f static const float MAX_AVATAR_SCALE = 1000.0f; static const float MIN_AVATAR_SCALE = 0.005f;