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) {
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);
setCollisionsEnabled(false);
setHMDLeanRecenterEnabled(false);
@ -6241,20 +6237,19 @@ void MyAvatar::beginSit(const glm::vec3& position, const glm::quat& rotation) {
clearPinOnJoint(hipIndex);
goToLocation(position, true, rotation, false, false);
pinJoint(hipIndex, position, rotation);
_isSeated = true;
}
void MyAvatar::endSit(const glm::vec3& position, const glm::quat& rotation) {
clearPinOnJoint(getJointIndex("Hips"));
_characterController.setSeated(false);
_characterController.updateState();
setCollisionsEnabled(true);
setHMDLeanRecenterEnabled(true);
centerBody();
float STANDUP_BUMP = 0.225f;
glm::vec3 currentPosition = getWorldPosition();
currentPosition.y = currentPosition.y + STANDUP_BUMP;
setWorldPosition(currentPosition);
// Enable movement again
setSitDriveKeysStatus(true);
if (_characterController.getSeated()) {
clearPinOnJoint(getJointIndex("Hips"));
_characterController.setSeated(false);
setCollisionsEnabled(true);
setHMDLeanRecenterEnabled(true);
centerBody();
setWorldPosition(position);
setWorldOrientation(rotation);
// Enable movement again
setSitDriveKeysStatus(true);
}
}

View file

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

View file

@ -806,7 +806,7 @@ void CharacterController::updateState() {
}
break;
}
case State::Hover:
case State::Hover: {
btScalar horizontalSpeed = (velocity - velocity.dot(_currentUp) * _currentUp).length();
bool flyingFast = horizontalSpeed > (MAX_WALKING_SPEED * 0.75f);
if (!_zoneFlyingAllowed) {
@ -819,6 +819,11 @@ void CharacterController::updateState() {
SET_STATE(State::Ground, "touching ground");
}
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 setSeated(bool isSeated) { _isSeated = isSeated; }
bool getSeated() { return _isSeated; }
protected:
#ifdef DEBUG_STATE_CHANGE