Merge branch 'master' of https://github.com/highfidelity/hifi into orange

This commit is contained in:
Sam Gateau 2015-04-16 10:27:13 -07:00
commit 9466cf9345
7 changed files with 28 additions and 22 deletions

4
.gitignore vendored
View file

@ -46,4 +46,6 @@ libraries/audio-client/external/*/*
gvr-interface/assets/oculussig*
gvr-interface/libs/*
TAGS
# ignore files for various dev environments
TAGS
*.swp

View file

@ -256,7 +256,7 @@ Menu::Menu() {
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::FullscreenMirror, Qt::Key_H, false,
qApp, SLOT(cameraMenuChanged()));
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::HMDTools, Qt::META | Qt::Key_H,
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::HMDTools, Qt::CTRL | Qt::Key_H,
false,
dialogsManager.data(),
SLOT(hmdTools(bool)));

View file

@ -127,7 +127,7 @@ void MyAvatar::reset() {
_skeletonModel.reset();
getHead()->reset();
_velocity = glm::vec3(0.0f);
_targetVelocity = glm::vec3(0.0f);
setThrust(glm::vec3(0.0f));
// Reset the pitch and roll components of the avatar's orientation, preserve yaw direction
glm::vec3 eulers = safeEulerAngles(getOrientation());
@ -1378,28 +1378,28 @@ glm::vec3 MyAvatar::applyScriptedMotor(float deltaTime, const glm::vec3& localVe
void MyAvatar::updatePosition(float deltaTime) {
// rotate velocity into camera frame
glm::quat rotation = getHead()->getCameraOrientation();
glm::vec3 localVelocity = glm::inverse(rotation) * _velocity;
glm::vec3 localVelocity = glm::inverse(rotation) * _targetVelocity;
bool isHovering = _characterController.isHovering();
glm::vec3 newLocalVelocity = applyKeyboardMotor(deltaTime, localVelocity, isHovering);
newLocalVelocity = applyScriptedMotor(deltaTime, newLocalVelocity);
// rotate back into world-frame
_velocity = rotation * newLocalVelocity;
_targetVelocity = rotation * newLocalVelocity;
_velocity += _thrust * deltaTime;
_targetVelocity += _thrust * deltaTime;
_thrust = glm::vec3(0.0f);
// cap avatar speed
float speed = glm::length(_velocity);
float speed = glm::length(_targetVelocity);
if (speed > MAX_AVATAR_SPEED) {
_velocity *= MAX_AVATAR_SPEED / speed;
_targetVelocity *= MAX_AVATAR_SPEED / speed;
speed = MAX_AVATAR_SPEED;
}
if (speed > MIN_AVATAR_SPEED && !_characterController.isEnabled()) {
// update position ourselves
applyPositionDelta(deltaTime * _velocity);
applyPositionDelta(deltaTime * _targetVelocity);
measureMotionDerivatives(deltaTime);
} // else physics will move avatar later

View file

@ -117,21 +117,21 @@ public:
virtual void clearJointData(int index);
virtual void clearJointsData();
void useFullAvatarURL(const QUrl& fullAvatarURL, const QString& modelName = QString());
void useHeadURL(const QUrl& headURL, const QString& modelName = QString());
void useBodyURL(const QUrl& bodyURL, const QString& modelName = QString());
void useHeadAndBodyURLs(const QUrl& headURL, const QUrl& bodyURL, const QString& headName = QString(), const QString& bodyName = QString());
Q_INVOKABLE void useFullAvatarURL(const QUrl& fullAvatarURL, const QString& modelName = QString());
Q_INVOKABLE void useHeadURL(const QUrl& headURL, const QString& modelName = QString());
Q_INVOKABLE void useBodyURL(const QUrl& bodyURL, const QString& modelName = QString());
Q_INVOKABLE void useHeadAndBodyURLs(const QUrl& headURL, const QUrl& bodyURL, const QString& headName = QString(), const QString& bodyName = QString());
bool getUseFullAvatar() const { return _useFullAvatar; }
const QUrl& getFullAvatarURLFromPreferences() const { return _fullAvatarURLFromPreferences; }
const QUrl& getHeadURLFromPreferences() const { return _headURLFromPreferences; }
const QUrl& getBodyURLFromPreferences() const { return _skeletonURLFromPreferences; }
Q_INVOKABLE bool getUseFullAvatar() const { return _useFullAvatar; }
Q_INVOKABLE const QUrl& getFullAvatarURLFromPreferences() const { return _fullAvatarURLFromPreferences; }
Q_INVOKABLE const QUrl& getHeadURLFromPreferences() const { return _headURLFromPreferences; }
Q_INVOKABLE const QUrl& getBodyURLFromPreferences() const { return _skeletonURLFromPreferences; }
const QString& getHeadModelName() const { return _headModelName; }
const QString& getBodyModelName() const { return _bodyModelName; }
const QString& getFullAvartarModelName() const { return _fullAvatarModelName; }
Q_INVOKABLE const QString& getHeadModelName() const { return _headModelName; }
Q_INVOKABLE const QString& getBodyModelName() const { return _bodyModelName; }
Q_INVOKABLE const QString& getFullAvartarModelName() const { return _fullAvatarModelName; }
QString getModelDescription() const;
Q_INVOKABLE QString getModelDescription() const;
virtual void setAttachmentData(const QVector<AttachmentData>& attachmentData);

View file

@ -60,6 +60,7 @@ AvatarData::AvatarData() :
_owningAvatarMixer(),
_lastUpdateTimer(),
_velocity(0.0f),
_targetVelocity(0.0f),
_localAABox(DEFAULT_LOCAL_AABOX_CORNER, DEFAULT_LOCAL_AABOX_SCALE)
{
}

View file

@ -296,6 +296,7 @@ public:
void setVelocity(const glm::vec3 velocity) { _velocity = velocity; }
Q_INVOKABLE glm::vec3 getVelocity() const { return _velocity; }
glm::vec3 getTargetVelocity() const { return _targetVelocity; }
public slots:
void sendAvatarDataPacket();
@ -386,6 +387,7 @@ protected:
void changeReferential(Referential* ref);
glm::vec3 _velocity;
glm::vec3 _targetVelocity;
AABox _localAABox;

View file

@ -386,7 +386,7 @@ void DynamicCharacterController::preSimulation(btScalar timeStep) {
setHovering(true);
}
_walkVelocity = glmToBullet(_avatarData->getVelocity());
_walkVelocity = glmToBullet(_avatarData->getTargetVelocity());
if (_pendingFlags & PENDING_FLAG_JUMP) {
_pendingFlags &= ~ PENDING_FLAG_JUMP;
@ -408,6 +408,7 @@ void DynamicCharacterController::postSimulation() {
_avatarData->setOrientation(rotation);
_avatarData->setPosition(position - rotation * _shapeLocalOffset);
_avatarData->setVelocity(bulletToGLM(_rigidBody->getLinearVelocity()));
}
}