mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 06:37:27 +02:00
Reset avatar on exit of away-mode.
Exposed MyAvatar.reset(bool) to script. away.js now calls this on exit of away-mode.
This commit is contained in:
parent
6dfd174285
commit
b7f157f4ff
3 changed files with 9 additions and 3 deletions
|
@ -196,6 +196,7 @@ function goActive() {
|
||||||
}
|
}
|
||||||
MyAvatar.setEnableMeshVisible(true); // IWBNI we respected Developer->Avatar->Draw Mesh setting.
|
MyAvatar.setEnableMeshVisible(true); // IWBNI we respected Developer->Avatar->Draw Mesh setting.
|
||||||
stopAwayAnimation();
|
stopAwayAnimation();
|
||||||
|
MyAvatar.reset(true);
|
||||||
hideOverlay();
|
hideOverlay();
|
||||||
|
|
||||||
// restore overlays state to what it was when we went "away"
|
// restore overlays state to what it was when we went "away"
|
||||||
|
|
|
@ -235,7 +235,12 @@ QByteArray MyAvatar::toByteArray(bool cullSmallChanges, bool sendAll) {
|
||||||
return AvatarData::toByteArray(cullSmallChanges, sendAll);
|
return AvatarData::toByteArray(cullSmallChanges, sendAll);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyAvatar::reset(bool andReload) {
|
void MyAvatar::reset(bool andRecenter) {
|
||||||
|
|
||||||
|
if (QThread::currentThread() != thread()) {
|
||||||
|
QMetaObject::invokeMethod(this, "reset", Q_ARG(bool, andRecenter));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Reset dynamic state.
|
// Reset dynamic state.
|
||||||
_wasPushing = _isPushing = _isBraking = false;
|
_wasPushing = _isPushing = _isBraking = false;
|
||||||
|
@ -245,7 +250,7 @@ void MyAvatar::reset(bool andReload) {
|
||||||
_targetVelocity = glm::vec3(0.0f);
|
_targetVelocity = glm::vec3(0.0f);
|
||||||
setThrust(glm::vec3(0.0f));
|
setThrust(glm::vec3(0.0f));
|
||||||
|
|
||||||
if (andReload) {
|
if (andRecenter) {
|
||||||
// derive the desired body orientation from the *old* hmd orientation, before the sensor reset.
|
// derive the desired body orientation from the *old* hmd orientation, before the sensor reset.
|
||||||
auto newBodySensorMatrix = deriveBodyFromHMDSensor(); // Based on current cached HMD position/rotation..
|
auto newBodySensorMatrix = deriveBodyFromHMDSensor(); // Based on current cached HMD position/rotation..
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ public:
|
||||||
AudioListenerMode getAudioListenerModeCamera() const { return FROM_CAMERA; }
|
AudioListenerMode getAudioListenerModeCamera() const { return FROM_CAMERA; }
|
||||||
AudioListenerMode getAudioListenerModeCustom() const { return CUSTOM; }
|
AudioListenerMode getAudioListenerModeCustom() const { return CUSTOM; }
|
||||||
|
|
||||||
void reset(bool andReload = false);
|
Q_INVOKABLE void reset(bool andRecenter = false);
|
||||||
void update(float deltaTime);
|
void update(float deltaTime);
|
||||||
void preRender(RenderArgs* renderArgs);
|
void preRender(RenderArgs* renderArgs);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue