private void ResizeCurrentAvatar() { if (!currentlySpawnedAvatar || !currentlySpawnedAvatar.avatar.descriptor.allowHeightCalibration) { return; } float scale; AvatarResizeMode resizeMode = _settings.resizeMode; switch (resizeMode) { case AvatarResizeMode.ArmSpan: float avatarArmLength = currentlySpawnedAvatar.avatar.armSpan; if (avatarArmLength > 0) { scale = _settings.playerArmSpan / avatarArmLength; } else { scale = 1.0f; } break; case AvatarResizeMode.Height: float avatarEyeHeight = currentlySpawnedAvatar.avatar.eyeHeight; float playerEyeHeight = _beatSaberUtilities.GetRoomAdjustedPlayerEyeHeight(); if (avatarEyeHeight > 0) { scale = playerEyeHeight / avatarEyeHeight; } else { scale = 1.0f; } break; default: scale = 1.0f; break; } if (scale <= 0) { _logger.Warning("Calculated scale is <= 0; reverting to 1"); scale = 1.0f; } currentlySpawnedAvatar.scale = scale; UpdateFloorOffsetForCurrentAvatar(); avatarScaleChanged?.Invoke(scale); }
internal float GetFloorOffset() { if (_settings.floorHeightAdjust == FloorHeightAdjust.Off || !currentlySpawnedAvatar) { return(0); } return(_beatSaberUtilities.GetRoomAdjustedPlayerEyeHeight() - currentlySpawnedAvatar.scaledEyeHeight); }