mirror of
https://github.com/overte-org/overte.git
synced 2025-04-26 06:36:08 +02:00
Fix flying bug.
This commit is contained in:
parent
108e8b9994
commit
4301d74df5
1 changed files with 2 additions and 8 deletions
|
@ -3434,7 +3434,7 @@ glm::vec3 MyAvatar::calculateScaledDirection(){
|
||||||
if (state == CharacterController::State::Hover ||
|
if (state == CharacterController::State::Hover ||
|
||||||
_characterController.computeCollisionMask() == BULLET_COLLISION_MASK_COLLISIONLESS) {
|
_characterController.computeCollisionMask() == BULLET_COLLISION_MASK_COLLISIONLESS) {
|
||||||
glm::vec3 up = (getDriveKey(TRANSLATE_Y)) * IDENTITY_UP;
|
glm::vec3 up = (getDriveKey(TRANSLATE_Y)) * IDENTITY_UP;
|
||||||
up /= glm::length(up);
|
//up /= glm::length(up);
|
||||||
direction += up;
|
direction += up;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3464,12 +3464,6 @@ void MyAvatar::updateActionMotor(float deltaTime) {
|
||||||
float directionLength = glm::length(direction);
|
float directionLength = glm::length(direction);
|
||||||
_isPushing = directionLength > EPSILON;
|
_isPushing = directionLength > EPSILON;
|
||||||
|
|
||||||
//if (_isPushing) {
|
|
||||||
// direction;
|
|
||||||
//} else {
|
|
||||||
// direction = Vectors::ZERO;
|
|
||||||
//}
|
|
||||||
|
|
||||||
if (!_isPushing) {
|
if (!_isPushing) {
|
||||||
direction = Vectors::ZERO;
|
direction = Vectors::ZERO;
|
||||||
}
|
}
|
||||||
|
@ -3486,7 +3480,7 @@ void MyAvatar::updateActionMotor(float deltaTime) {
|
||||||
const float maxBoostSpeed = sensorToWorldScale * MAX_BOOST_SPEED;
|
const float maxBoostSpeed = sensorToWorldScale * MAX_BOOST_SPEED;
|
||||||
|
|
||||||
if (_isPushing) {
|
if (_isPushing) {
|
||||||
direction /= direction;
|
direction /= directionLength;
|
||||||
if (motorSpeed < maxBoostSpeed) {
|
if (motorSpeed < maxBoostSpeed) {
|
||||||
// an active action motor should never be slower than this
|
// an active action motor should never be slower than this
|
||||||
float boostCoefficient = (maxBoostSpeed - motorSpeed) / maxBoostSpeed;
|
float boostCoefficient = (maxBoostSpeed - motorSpeed) / maxBoostSpeed;
|
||||||
|
|
Loading…
Reference in a new issue