mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-12-06 00:32:35 -08:00
Full height for manual configuration (#1329)
Co-authored-by: lucas lelievre <[email protected]>
This commit is contained in:
1 parent
a0cedde4b7
commit
3f1a794148
8 files changed
+59
-37
No files matched your search
@@ -55,8 +55,8 @@ export function ProportionsResetModal({
|
||||
<Localized
|
||||
id={
|
||||
usingDefaultHeight
|
||||
? 'reset-reset_all_warning_default'
|
||||
: 'reset-reset_all_warning'
|
||||
? 'reset-reset_all_warning_default-v2'
|
||||
: 'reset-reset_all_warning-v2'
|
||||
}
|
||||
elems={{ b: <b></b> }}
|
||||
>
|
||||
|
||||
+3
-2
@@ -12,7 +12,7 @@ import { Typography } from '@/components/commons/Typography';
|
||||
import { Localized, useLocalization } from '@fluent/react';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { useLocaleConfig } from '@/i18n/config';
|
||||
import { useHeightContext } from '@/hooks/height';
|
||||
import { EYE_HEIGHT_TO_HEIGHT_RATIO, useHeightContext } from '@/hooks/height';
|
||||
import { useInterval } from '@/hooks/timeout';
|
||||
import { TooSmolModal } from './TooSmolModal';
|
||||
|
||||
@@ -137,7 +137,8 @@ export function CheckFloorHeightStep({
|
||||
</Typography>
|
||||
<Typography>
|
||||
{mFormat.format(
|
||||
((hmdHeight ?? 0) - (floorHeight ?? 0)) / 0.936
|
||||
((hmdHeight ?? 0) - (floorHeight ?? 0)) /
|
||||
EYE_HEIGHT_TO_HEIGHT_RATIO
|
||||
)}
|
||||
</Typography>
|
||||
</div>
|
||||
|
||||
+18
-6
@@ -4,7 +4,7 @@ import { Typography } from '@/components/commons/Typography';
|
||||
import { Localized, useLocalization } from '@fluent/react';
|
||||
import { useMemo } from 'react';
|
||||
import { useLocaleConfig } from '@/i18n/config';
|
||||
import { useHeightContext } from '@/hooks/height';
|
||||
import { EYE_HEIGHT_TO_HEIGHT_RATIO, useHeightContext } from '@/hooks/height';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import {
|
||||
ChangeSettingsRequestT,
|
||||
@@ -36,12 +36,13 @@ export function ManualHeightStep({
|
||||
const { state } = useOnboarding();
|
||||
const { l10n } = useLocalization();
|
||||
const { setHmdHeight } = useHeightContext();
|
||||
const { control, handleSubmit, formState } = useForm<HeightForm>({
|
||||
const { control, handleSubmit, formState, watch } = useForm<HeightForm>({
|
||||
defaultValues: { height: 1.5 },
|
||||
});
|
||||
const { sendRPCPacket } = useWebsocketAPI();
|
||||
const { currentLocales } = useLocaleConfig();
|
||||
const { statuses } = useStatusContext();
|
||||
const height = watch('height');
|
||||
|
||||
const missingSteamConnection = useMemo(
|
||||
() =>
|
||||
@@ -65,13 +66,14 @@ export function ManualHeightStep({
|
||||
);
|
||||
|
||||
const submitHmdHeight = (values: HeightForm) => {
|
||||
setHmdHeight(values.height);
|
||||
const newHeight = values.height * EYE_HEIGHT_TO_HEIGHT_RATIO;
|
||||
setHmdHeight(newHeight);
|
||||
const settingsRequest = new ChangeSettingsRequestT();
|
||||
settingsRequest.modelSettings = new ModelSettingsT(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
new SkeletonHeightT(values.height, 0)
|
||||
new SkeletonHeightT(newHeight, 0)
|
||||
);
|
||||
sendRPCPacket(RpcMessage.ChangeSettingsRequest, settingsRequest);
|
||||
nextStep();
|
||||
@@ -92,7 +94,7 @@ export function ManualHeightStep({
|
||||
<div>
|
||||
<Typography color="secondary">
|
||||
{l10n.getString(
|
||||
'onboarding-scaled_proportions-manual_height-description'
|
||||
'onboarding-scaled_proportions-manual_height-description-v2'
|
||||
)}
|
||||
</Typography>
|
||||
{missingSteamConnection && (
|
||||
@@ -112,7 +114,7 @@ export function ManualHeightStep({
|
||||
control={control}
|
||||
name="height"
|
||||
label={l10n.getString(
|
||||
'onboarding-scaled_proportions-manual_height-height'
|
||||
'onboarding-scaled_proportions-manual_height-height-v2'
|
||||
)}
|
||||
valueLabelFormat={(value) =>
|
||||
isNaN(value)
|
||||
@@ -128,6 +130,16 @@ export function ManualHeightStep({
|
||||
doubleStep={0.1}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-col self-center items-center justify-center">
|
||||
<Typography>
|
||||
{l10n.getString(
|
||||
'onboarding-scaled_proportions-manual_height-estimated_height'
|
||||
)}
|
||||
</Typography>
|
||||
<Typography>
|
||||
{mFormat.format(height * EYE_HEIGHT_TO_HEIGHT_RATIO)}
|
||||
</Typography>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -56,3 +56,8 @@ export function useHeightContext() {
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
// The headset height is not the full height! This value compensates for the
|
||||
// offset from the headset height to the user full height
|
||||
// From Drillis and Contini (1966)
|
||||
export const EYE_HEIGHT_TO_HEIGHT_RATIO = 0.936;
|
||||
Reference in new issue
Block a user