Cope with slight avatar position and orientation jitter when stationary

This commit is contained in:
David Rowe 2020-01-06 11:14:12 +13:00
parent 81e1dd4d6a
commit a1056f34ed

View file

@ -25,6 +25,9 @@ var ALTITUDE_RATE = 200.0;
var RADIUS_RATE = 1.0 / 100.0;
var PAN_RATE = 250.0;
var AVATAR_POSITION_SLOP = 0.1;
var AVATAR_ROTATION_SLOP = 0.09; // 5 degrees
var Y_AXIS = {
x: 0,
y: 1,
@ -179,14 +182,10 @@ function handleModes() {
avatarOrientation = MyAvatar.orientation;
}
// if leaving detachMode
if (mode === detachedMode && newMode === detachedMode &&
(avatarPosition.x !== MyAvatar.position.x ||
avatarPosition.y !== MyAvatar.position.y ||
avatarPosition.z !== MyAvatar.position.z ||
avatarOrientation.x !== MyAvatar.orientation.x ||
avatarOrientation.y !== MyAvatar.orientation.y ||
avatarOrientation.z !== MyAvatar.orientation.z ||
avatarOrientation.w !== MyAvatar.orientation.w)) {
if (mode === detachedMode && newMode === detachedMode && (
Vec3.length(Vec3.subtract(avatarPosition, MyAvatar.position)) > AVATAR_POSITION_SLOP
|| Vec3.length(Vec3.subtract(Quat.getFront(avatarOrientation), Quat.getFront(MyAvatar.orientation)))
> AVATAR_ROTATION_SLOP)) {
newMode = noMode;
}