mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
fix: word tolerant pitch and yaw
This commit is contained in:
1 parent
40b6f30092
commit
78e6b2696c
1 file changed
+16
-2
@@ -57,9 +57,16 @@ export function RotationInputs({ isFullScreen }: RotationInputsProps) {
|
|||||||
textAlign: 'right',
|
textAlign: 'right',
|
||||||
}}
|
}}
|
||||||
onBlur={() => {
|
onBlur={() => {
|
||||||
|
const value = Number(turretYawInput.current!.value);
|
||||||
|
if (isNaN(value)) {
|
||||||
|
turretYawInput.current!.value = radToDeg(protagonist.yaw).toFixed(
|
||||||
|
1,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const [pitch, yaw] = applyPitchYawLimits(
|
const [pitch, yaw] = applyPitchYawLimits(
|
||||||
protagonist.pitch,
|
protagonist.pitch,
|
||||||
degToRad(Number(turretYawInput.current!.value)),
|
degToRad(value),
|
||||||
gunModelDefinition.pitch,
|
gunModelDefinition.pitch,
|
||||||
turretModelDefinition.yaw,
|
turretModelDefinition.yaw,
|
||||||
hasImprovedVerticalStabilizer,
|
hasImprovedVerticalStabilizer,
|
||||||
@@ -97,8 +104,15 @@ export function RotationInputs({ isFullScreen }: RotationInputsProps) {
|
|||||||
textAlign: 'right',
|
textAlign: 'right',
|
||||||
}}
|
}}
|
||||||
onBlur={() => {
|
onBlur={() => {
|
||||||
|
const value = Number(gunPitchInput.current!.value);
|
||||||
|
if (isNaN(value)) {
|
||||||
|
gunPitchInput.current!.value = (
|
||||||
|
-radToDeg(protagonist.pitch) + initialGunPitch
|
||||||
|
).toFixed(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const [pitch, yaw] = applyPitchYawLimits(
|
const [pitch, yaw] = applyPitchYawLimits(
|
||||||
degToRad(-Number(gunPitchInput.current!.value) + initialGunPitch),
|
degToRad(-value + initialGunPitch),
|
||||||
protagonist.yaw,
|
protagonist.yaw,
|
||||||
gunModelDefinition.pitch,
|
gunModelDefinition.pitch,
|
||||||
turretModelDefinition.yaw,
|
turretModelDefinition.yaw,
|
||||||
|
|||||||
Reference in new issue
Block a user