mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 03:50:40 +02:00
Actually the full set of changes. Kids: don't forget to pop your stash.
This commit is contained in:
parent
8f34ec4c7f
commit
49881b5ea2
3 changed files with 14 additions and 1 deletions
|
@ -268,6 +268,17 @@ QVariant MyAvatar::getOrientationVar() const {
|
||||||
return quatToVariant(Avatar::getOrientation());
|
return quatToVariant(Avatar::getOrientation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glm::quat MyAvatar::getOrientationOutbound() const {
|
||||||
|
// Allows MyAvatar to send out smoothed data to remote agents if required.
|
||||||
|
if (_smoothOrientationTimer > _smoothOrientationTime) {
|
||||||
|
return (getLocalOrientation());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Smooth the remote avatar movement.
|
||||||
|
float t = _smoothOrientationTimer / _smoothOrientationTime;
|
||||||
|
float l = easeInOutQuad(glm::clamp(t, 0.0f, 1.0f));
|
||||||
|
return (slerp(_smoothOrientationInitial, _smoothOrientationTarget, l));
|
||||||
|
}
|
||||||
|
|
||||||
// virtual
|
// virtual
|
||||||
void MyAvatar::simulateAttachments(float deltaTime) {
|
void MyAvatar::simulateAttachments(float deltaTime) {
|
||||||
|
|
|
@ -187,6 +187,8 @@ public:
|
||||||
Q_INVOKABLE void setOrientationVar(const QVariant& newOrientationVar);
|
Q_INVOKABLE void setOrientationVar(const QVariant& newOrientationVar);
|
||||||
Q_INVOKABLE QVariant getOrientationVar() const;
|
Q_INVOKABLE QVariant getOrientationVar() const;
|
||||||
|
|
||||||
|
// A method intended to be overriden by MyAvatar for polling orientation for network transmission.
|
||||||
|
virtual glm::quat getOrientationOutbound() const override;
|
||||||
|
|
||||||
// Pass a recent sample of the HMD to the avatar.
|
// Pass a recent sample of the HMD to the avatar.
|
||||||
// This can also update the avatar's position to follow the HMD
|
// This can also update the avatar's position to follow the HMD
|
||||||
|
|
|
@ -312,7 +312,7 @@ QByteArray AvatarData::toByteArray(AvatarDataDetail dataDetail, quint64 lastSent
|
||||||
|
|
||||||
if (hasAvatarOrientation) {
|
if (hasAvatarOrientation) {
|
||||||
auto startSection = destinationBuffer;
|
auto startSection = destinationBuffer;
|
||||||
auto localOrientation = getLocalOrientation();
|
auto localOrientation = getOrientationOutbound();
|
||||||
destinationBuffer += packOrientationQuatToSixBytes(destinationBuffer, localOrientation);
|
destinationBuffer += packOrientationQuatToSixBytes(destinationBuffer, localOrientation);
|
||||||
|
|
||||||
int numBytes = destinationBuffer - startSection;
|
int numBytes = destinationBuffer - startSection;
|
||||||
|
|
Loading…
Reference in a new issue