mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-11 21:52:43 +02:00
CR
This commit is contained in:
parent
35dd45ddf9
commit
3e9474e878
2 changed files with 14 additions and 18 deletions
|
@ -89,8 +89,6 @@ class MyAvatar : public Avatar {
|
|||
Q_PROPERTY(bool hmdLeanRecenterEnabled READ getHMDLeanRecenterEnabled WRITE setHMDLeanRecenterEnabled)
|
||||
Q_PROPERTY(bool characterControllerEnabled READ getCharacterControllerEnabled WRITE setCharacterControllerEnabled)
|
||||
|
||||
Q_ENUMS(DriveKeys)
|
||||
|
||||
public:
|
||||
explicit MyAvatar(RigPointer rig);
|
||||
~MyAvatar();
|
||||
|
@ -185,13 +183,13 @@ public:
|
|||
// Set what driving keys are being pressed to control thrust levels
|
||||
void clearDriveKeys();
|
||||
void setDriveKey(int key, float val) { _driveKeys[key] = val; };
|
||||
float getDriveKey(int key) const { return isDriveKeyCaptured(key) ? 0.0f : _driveKeys[key]; };
|
||||
float getDriveKey(int key) const { return isDriveKeyDisabled(key) ? 0.0f : _driveKeys[key]; };
|
||||
Q_INVOKABLE float getRawDriveKey(int key) const { return _driveKeys[key]; };
|
||||
void relayDriveKeysToCharacterController();
|
||||
|
||||
Q_INVOKABLE void captureDriveKey(int key) { _capturedDriveKeys.set(key); }
|
||||
Q_INVOKABLE void releaseDriveKey(int key) { _capturedDriveKeys.reset(key); }
|
||||
Q_INVOKABLE bool isDriveKeyCaptured(int key) const { return _capturedDriveKeys.test(key); }
|
||||
Q_INVOKABLE void disableDriveKey(int key) { _disabledDriveKeys.set(key); }
|
||||
Q_INVOKABLE void enableDriveKey(int key) { _disabledDriveKeys.reset(key); }
|
||||
Q_INVOKABLE bool isDriveKeyDisabled(int key) const { return _disabledDriveKeys.test(key); }
|
||||
|
||||
eyeContactTarget getEyeContactTarget();
|
||||
|
||||
|
@ -397,8 +395,8 @@ private:
|
|||
void clampScaleChangeToDomainLimits(float desiredScale);
|
||||
glm::mat4 computeCameraRelativeHandControllerMatrix(const glm::mat4& controllerSensorMatrix) const;
|
||||
|
||||
std::array<float, MAX_DRIVE_KEYS> _driveKeys;
|
||||
std::bitset<MAX_DRIVE_KEYS> _capturedDriveKeys;
|
||||
float _driveKeys[MAX_DRIVE_KEYS];
|
||||
std::bitset<MAX_DRIVE_KEYS> _disabledDriveKeys;
|
||||
|
||||
bool _wasPushing;
|
||||
bool _isPushing;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
this.entityID = null;
|
||||
this.animStateHandlerID = null;
|
||||
this.interval = null;
|
||||
this.sitDownTimestamp = null;
|
||||
this.sitDownSettlePeriod = null;
|
||||
this.lastTimeNoDriveKeys = null;
|
||||
|
||||
this.preload = function(entityID) {
|
||||
|
@ -100,8 +100,9 @@
|
|||
}
|
||||
print("Sitting down (" + this.entityID + ")");
|
||||
|
||||
this.sitDownTimestamp = Date.now();
|
||||
this.lastTimeNoDriveKeys = this.sitDownTimestamp;
|
||||
var now = Date.now();
|
||||
this.sitDownSettlePeriod = now + IK_SETTLE_TIME;
|
||||
this.lastTimeNoDriveKeys = now;
|
||||
|
||||
var previousValue = Settings.getValue(SETTING_KEY);
|
||||
Settings.setValue(SETTING_KEY, this.entityID);
|
||||
|
@ -125,7 +126,7 @@
|
|||
}, ["headType"]);
|
||||
Script.update.connect(this, this.update);
|
||||
for (var i in OVERRIDEN_DRIVE_KEYS) {
|
||||
MyAvatar.captureDriveKey(OVERRIDEN_DRIVE_KEYS[i]);
|
||||
MyAvatar.disableDriveKey(OVERRIDEN_DRIVE_KEYS[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,7 +135,7 @@
|
|||
MyAvatar.removeAnimationStateHandler(this.animStateHandlerID);
|
||||
Script.update.disconnect(this, this.update);
|
||||
for (var i in OVERRIDEN_DRIVE_KEYS) {
|
||||
MyAvatar.releaseDriveKey(OVERRIDEN_DRIVE_KEYS[i]);
|
||||
MyAvatar.enableDriveKey(OVERRIDEN_DRIVE_KEYS[i]);
|
||||
}
|
||||
|
||||
this.setSeatUser(null);
|
||||
|
@ -232,11 +233,8 @@
|
|||
}
|
||||
|
||||
// Allow some time for the IK to settle
|
||||
if (ikError > MAX_IK_ERROR) {
|
||||
var elapsed = now - this.sitDownTimestamp;
|
||||
if (elapsed > IK_SETTLE_TIME) {
|
||||
shouldStandUp = true;
|
||||
}
|
||||
if (ikError > MAX_IK_ERROR && now > this.sitDownSettlePeriod) {
|
||||
shouldStandUp = true;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue