Fix code and warnings

This commit is contained in:
luiscuenca 2019-07-24 13:16:53 -07:00
parent 015d1951fc
commit 6e4d1bde8e
No known key found for this signature in database
GPG key ID: 2387ECD129A6961D
4 changed files with 19 additions and 19 deletions

View file

@ -6227,10 +6227,6 @@ void MyAvatar::setSitDriveKeysStatus(bool enabled) {
} }
void MyAvatar::beginSit(const glm::vec3& position, const glm::quat& rotation) { void MyAvatar::beginSit(const glm::vec3& position, const glm::quat& rotation) {
const QString ANIMATION_URL = PathUtils::defaultScriptsLocation().toString() + "/resources/animations/sittingIdle.fbx";
const int ANIMATION_FPS = 30;
const int ANIMATION_FIRST_FRAME = 1;
const int ANIMATION_LAST_FRAME = 350;
_characterController.setSeated(true); _characterController.setSeated(true);
setCollisionsEnabled(false); setCollisionsEnabled(false);
setHMDLeanRecenterEnabled(false); setHMDLeanRecenterEnabled(false);
@ -6241,20 +6237,19 @@ void MyAvatar::beginSit(const glm::vec3& position, const glm::quat& rotation) {
clearPinOnJoint(hipIndex); clearPinOnJoint(hipIndex);
goToLocation(position, true, rotation, false, false); goToLocation(position, true, rotation, false, false);
pinJoint(hipIndex, position, rotation); pinJoint(hipIndex, position, rotation);
_isSeated = true;
} }
void MyAvatar::endSit(const glm::vec3& position, const glm::quat& rotation) { void MyAvatar::endSit(const glm::vec3& position, const glm::quat& rotation) {
if (_characterController.getSeated()) {
clearPinOnJoint(getJointIndex("Hips")); clearPinOnJoint(getJointIndex("Hips"));
_characterController.setSeated(false); _characterController.setSeated(false);
_characterController.updateState();
setCollisionsEnabled(true); setCollisionsEnabled(true);
setHMDLeanRecenterEnabled(true); setHMDLeanRecenterEnabled(true);
centerBody(); centerBody();
float STANDUP_BUMP = 0.225f; setWorldPosition(position);
glm::vec3 currentPosition = getWorldPosition(); setWorldOrientation(rotation);
currentPosition.y = currentPosition.y + STANDUP_BUMP;
setWorldPosition(currentPosition);
// Enable movement again // Enable movement again
setSitDriveKeysStatus(true); setSitDriveKeysStatus(true);
}
} }

View file

@ -2554,7 +2554,6 @@ private:
bool _isBeingPushed { false }; bool _isBeingPushed { false };
bool _isBraking { false }; bool _isBraking { false };
bool _isAway { false }; bool _isAway { false };
bool _isSeated { false };
float _boomLength { ZOOM_DEFAULT }; float _boomLength { ZOOM_DEFAULT };
float _yawSpeed; // degrees/sec float _yawSpeed; // degrees/sec

View file

@ -806,7 +806,7 @@ void CharacterController::updateState() {
} }
break; break;
} }
case State::Hover: case State::Hover: {
btScalar horizontalSpeed = (velocity - velocity.dot(_currentUp) * _currentUp).length(); btScalar horizontalSpeed = (velocity - velocity.dot(_currentUp) * _currentUp).length();
bool flyingFast = horizontalSpeed > (MAX_WALKING_SPEED * 0.75f); bool flyingFast = horizontalSpeed > (MAX_WALKING_SPEED * 0.75f);
if (!_zoneFlyingAllowed) { if (!_zoneFlyingAllowed) {
@ -820,6 +820,11 @@ void CharacterController::updateState() {
} }
break; break;
} }
case State::Seated: {
SET_STATE(State::Ground, "Standing up");
break;
}
}
} }
} }

View file

@ -137,6 +137,7 @@ public:
void setPendingFlagsUpdateCollisionMask(){ _pendingFlags |= PENDING_FLAG_UPDATE_COLLISION_MASK; } void setPendingFlagsUpdateCollisionMask(){ _pendingFlags |= PENDING_FLAG_UPDATE_COLLISION_MASK; }
void setSeated(bool isSeated) { _isSeated = isSeated; } void setSeated(bool isSeated) { _isSeated = isSeated; }
bool getSeated() { return _isSeated; }
protected: protected:
#ifdef DEBUG_STATE_CHANGE #ifdef DEBUG_STATE_CHANGE