mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-25 03:29:51 +01:00
fix: depression
This commit is contained in:
1 parent
ad9f2d8609
commit
07ce61d19f
2 files changed
+6
-8
No files matched your search
@@ -71,10 +71,8 @@ export function applyPitchYawLimits(
|
|||||||
throw new Error("Pitch limits not found");
|
throw new Error("Pitch limits not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
const spanUp = normalizeAngleDeg(rightLimitUp.angle - leftLimitUp.angle);
|
const spanUp = rightLimitUp.angle - leftLimitUp.angle;
|
||||||
const spanDown = normalizeAngleDeg(
|
const spanDown = rightLimitDown.angle - leftLimitDown.angle;
|
||||||
rightLimitDown.angle - leftLimitDown.angle
|
|
||||||
);
|
|
||||||
|
|
||||||
let limitUp: number;
|
let limitUp: number;
|
||||||
let limitDown: number;
|
let limitDown: number;
|
||||||
@@ -82,7 +80,7 @@ export function applyPitchYawLimits(
|
|||||||
if (spanUp === 0) {
|
if (spanUp === 0) {
|
||||||
limitUp = leftLimitUp.limit;
|
limitUp = leftLimitUp.limit;
|
||||||
} else {
|
} else {
|
||||||
const delta = normalizeAngleDeg(givenYawDeg - leftLimitUp.angle);
|
const delta = givenYawDeg - leftLimitUp.angle;
|
||||||
const t = delta / spanUp;
|
const t = delta / spanUp;
|
||||||
limitUp = lerp(leftLimitUp.limit, rightLimitUp.limit, t);
|
limitUp = lerp(leftLimitUp.limit, rightLimitUp.limit, t);
|
||||||
}
|
}
|
||||||
@@ -90,12 +88,12 @@ export function applyPitchYawLimits(
|
|||||||
if (spanDown === 0) {
|
if (spanDown === 0) {
|
||||||
limitDown = leftLimitDown.limit;
|
limitDown = leftLimitDown.limit;
|
||||||
} else {
|
} else {
|
||||||
const delta = normalizeAngleDeg(givenYawDeg - leftLimitDown.angle);
|
const delta = givenYawDeg - leftLimitDown.angle;
|
||||||
const t = delta / spanDown;
|
const t = delta / spanDown;
|
||||||
limitDown = lerp(leftLimitDown.limit, rightLimitDown.limit, t);
|
limitDown = lerp(leftLimitDown.limit, rightLimitDown.limit, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
const pitchDeg = clamp(givenPitchDeg, limitUp, -limitDown);
|
const pitchDeg = clamp(givenPitchDeg, -limitDown, limitUp);
|
||||||
const pitch = degToRad(pitchDeg);
|
const pitch = degToRad(pitchDeg);
|
||||||
|
|
||||||
return { pitch, yaw };
|
return { pitch, yaw };
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ export const characteristics = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
gun_depression({ parameters }) {
|
gun_depression({ parameters }) {
|
||||||
return radToDeg(
|
return -radToDeg(
|
||||||
applyPitchYawLimits(
|
applyPitchYawLimits(
|
||||||
-Math.PI / 2,
|
-Math.PI / 2,
|
||||||
0,
|
0,
|
||||||
|
|||||||
Reference in new issue
Block a user