mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 20:19:49 +02:00
fix: use bounding rects for rotation inputs
This commit is contained in:
1 parent
d601e9fbc3
commit
3e0e05b8cc
1 file changed
+5
-3
@@ -172,9 +172,10 @@ export const TankModel = memo(() => {
|
|||||||
duel.protagonist!.tank.equipment,
|
duel.protagonist!.tank.equipment,
|
||||||
duel.protagonist!.equipmentMatrix,
|
duel.protagonist!.equipmentMatrix,
|
||||||
);
|
);
|
||||||
|
const boundingRect = canvas.getBoundingClientRect();
|
||||||
[pitch, yaw] = applyPitchYawLimits(
|
[pitch, yaw] = applyPitchYawLimits(
|
||||||
pitch,
|
pitch,
|
||||||
yaw + event.movementX * (Math.PI / canvas.width),
|
yaw + event.movementX * (Math.PI / boundingRect.width),
|
||||||
gunModelDefinition.pitch,
|
gunModelDefinition.pitch,
|
||||||
turretModelDefinition.yaw,
|
turretModelDefinition.yaw,
|
||||||
hasImprovedVerticalStabilizer,
|
hasImprovedVerticalStabilizer,
|
||||||
@@ -242,9 +243,10 @@ export const TankModel = memo(() => {
|
|||||||
duel.protagonist!.tank.equipment,
|
duel.protagonist!.tank.equipment,
|
||||||
duel.protagonist!.equipmentMatrix,
|
duel.protagonist!.equipmentMatrix,
|
||||||
);
|
);
|
||||||
|
const boundingRect = canvas.getBoundingClientRect();
|
||||||
[pitch, yaw] = applyPitchYawLimits(
|
[pitch, yaw] = applyPitchYawLimits(
|
||||||
pitch - event.movementY * (Math.PI / canvas.height),
|
pitch - event.movementY * (Math.PI / boundingRect.height),
|
||||||
yaw + event.movementX * (Math.PI / canvas.width),
|
yaw + event.movementX * (Math.PI / boundingRect.width),
|
||||||
gunModelDefinition.pitch,
|
gunModelDefinition.pitch,
|
||||||
turretModelDefinition.yaw,
|
turretModelDefinition.yaw,
|
||||||
hasImprovedVerticalStabilizer,
|
hasImprovedVerticalStabilizer,
|
||||||
|
|||||||
Reference in new issue
Block a user