mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 10:49:33 +02:00
MyAvatar: copy body velocity + hmd follow velocity onto avatar
This was inadvertently removed in a previous PR. https://github.com/highfidelity/hifi/pull/6895 Also, renamed Velocity stat to Speed.
This commit is contained in:
parent
dc6662d115
commit
c771c925c8
6 changed files with 15 additions and 4 deletions
|
@ -136,7 +136,7 @@ Item {
|
||||||
Text {
|
Text {
|
||||||
color: root.fontColor;
|
color: root.fontColor;
|
||||||
font.pixelSize: root.fontSize
|
font.pixelSize: root.fontSize
|
||||||
text: "Velocity: " + root.velocity.toFixed(1)
|
text: "Speed: " + root.speed.toFixed(1)
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
color: root.fontColor;
|
color: root.fontColor;
|
||||||
|
|
|
@ -1042,6 +1042,8 @@ void MyAvatar::harvestResultsFromPhysicsSimulation(float deltaTime) {
|
||||||
nextAttitude(position, orientation);
|
nextAttitude(position, orientation);
|
||||||
_bodySensorMatrix = _follow.postPhysicsUpdate(*this, _bodySensorMatrix);
|
_bodySensorMatrix = _follow.postPhysicsUpdate(*this, _bodySensorMatrix);
|
||||||
|
|
||||||
|
setVelocity(_characterController.getLinearVelocity() + _characterController.getFollowVelocity());
|
||||||
|
|
||||||
// now that physics has adjusted our position, we can update attachements.
|
// now that physics has adjusted our position, we can update attachements.
|
||||||
Avatar::simulateAttachments(deltaTime);
|
Avatar::simulateAttachments(deltaTime);
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,7 @@ void Stats::updateStats(bool force) {
|
||||||
MyAvatar* myAvatar = avatarManager->getMyAvatar();
|
MyAvatar* myAvatar = avatarManager->getMyAvatar();
|
||||||
glm::vec3 avatarPos = myAvatar->getPosition();
|
glm::vec3 avatarPos = myAvatar->getPosition();
|
||||||
STAT_UPDATE(position, QVector3D(avatarPos.x, avatarPos.y, avatarPos.z));
|
STAT_UPDATE(position, QVector3D(avatarPos.x, avatarPos.y, avatarPos.z));
|
||||||
STAT_UPDATE_FLOAT(velocity, glm::length(myAvatar->getVelocity()), 0.1f);
|
STAT_UPDATE_FLOAT(speed, glm::length(myAvatar->getVelocity()), 0.1f);
|
||||||
STAT_UPDATE_FLOAT(yaw, myAvatar->getBodyYaw(), 0.1f);
|
STAT_UPDATE_FLOAT(yaw, myAvatar->getBodyYaw(), 0.1f);
|
||||||
if (_expanded || force) {
|
if (_expanded || force) {
|
||||||
SharedNodePointer avatarMixer = nodeList->soloNodeOfType(NodeType::AvatarMixer);
|
SharedNodePointer avatarMixer = nodeList->soloNodeOfType(NodeType::AvatarMixer);
|
||||||
|
|
|
@ -47,7 +47,7 @@ class Stats : public QQuickItem {
|
||||||
STATS_PROPERTY(int, entitiesPing, 0)
|
STATS_PROPERTY(int, entitiesPing, 0)
|
||||||
STATS_PROPERTY(int, assetPing, 0)
|
STATS_PROPERTY(int, assetPing, 0)
|
||||||
STATS_PROPERTY(QVector3D, position, QVector3D(0, 0, 0) )
|
STATS_PROPERTY(QVector3D, position, QVector3D(0, 0, 0) )
|
||||||
STATS_PROPERTY(float, velocity, 0)
|
STATS_PROPERTY(float, speed, 0)
|
||||||
STATS_PROPERTY(float, yaw, 0)
|
STATS_PROPERTY(float, yaw, 0)
|
||||||
STATS_PROPERTY(int, avatarMixerInKbps, 0)
|
STATS_PROPERTY(int, avatarMixerInKbps, 0)
|
||||||
STATS_PROPERTY(int, avatarMixerInPps, 0)
|
STATS_PROPERTY(int, avatarMixerInPps, 0)
|
||||||
|
@ -138,7 +138,7 @@ signals:
|
||||||
void entitiesPingChanged();
|
void entitiesPingChanged();
|
||||||
void assetPingChanged();
|
void assetPingChanged();
|
||||||
void positionChanged();
|
void positionChanged();
|
||||||
void velocityChanged();
|
void speedChanged();
|
||||||
void yawChanged();
|
void yawChanged();
|
||||||
void avatarMixerInKbpsChanged();
|
void avatarMixerInKbpsChanged();
|
||||||
void avatarMixerInPpsChanged();
|
void avatarMixerInPpsChanged();
|
||||||
|
|
|
@ -390,6 +390,14 @@ glm::quat CharacterController::getFollowAngularDisplacement() const {
|
||||||
return bulletToGLM(_followAngularDisplacement);
|
return bulletToGLM(_followAngularDisplacement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glm::vec3 CharacterController::getFollowVelocity() const {
|
||||||
|
if (_followTime > 0.0f) {
|
||||||
|
return bulletToGLM(_followLinearDisplacement) / _followTime;
|
||||||
|
} else {
|
||||||
|
return glm::vec3();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
glm::vec3 CharacterController::getLinearVelocity() const {
|
glm::vec3 CharacterController::getLinearVelocity() const {
|
||||||
glm::vec3 velocity(0.0f);
|
glm::vec3 velocity(0.0f);
|
||||||
if (_rigidBody) {
|
if (_rigidBody) {
|
||||||
|
|
|
@ -71,6 +71,7 @@ public:
|
||||||
float getFollowTime() const { return _followTime; }
|
float getFollowTime() const { return _followTime; }
|
||||||
glm::vec3 getFollowLinearDisplacement() const;
|
glm::vec3 getFollowLinearDisplacement() const;
|
||||||
glm::quat getFollowAngularDisplacement() const;
|
glm::quat getFollowAngularDisplacement() const;
|
||||||
|
glm::vec3 getFollowVelocity() const;
|
||||||
|
|
||||||
glm::vec3 getLinearVelocity() const;
|
glm::vec3 getLinearVelocity() const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue