mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-12-04 23:32:54 +01:00
migrate compare and tankopedia loadout to new data-driven components, splitting the old monolithic loadout and compare UI into smaller pieces and adding shared Table, Dialog and Scroller primitives
This commit is contained in:
111 files changed
+4009
-3917
No files matched your search
@@ -1,27 +1,18 @@
|
||||
import { useEffect } from "react";
|
||||
import { degToRad } from "three/src/math/MathUtils.js";
|
||||
import { api } from "../api/dynamic";
|
||||
import { applyPitchYawLimits } from "../core/blitz/applyPitchYawLimits";
|
||||
import { modelTransformEvent } from "../core/blitzkit/modelTransform";
|
||||
import { DuelModule, useDuel } from "../hooks/useDuel";
|
||||
|
||||
const modelDefinitions = await api.models();
|
||||
import { useDuelModels } from "../hooks/useDuelModels";
|
||||
|
||||
export function InitialCameraAligner() {
|
||||
const tank = useDuel("protagonist", DuelModule.Tank);
|
||||
const turret = useDuel("protagonist", DuelModule.Turret);
|
||||
const gun = useDuel("protagonist", DuelModule.Gun);
|
||||
|
||||
const tankModel = modelDefinitions.models[tank.id];
|
||||
const turretModel = tankModel.turrets[turret.id];
|
||||
const gunModel = turretModel.guns[gun.id];
|
||||
const { turret, gun } = useDuelModels("protagonist");
|
||||
|
||||
useEffect(() => {
|
||||
const [pitch, yaw] = applyPitchYawLimits(
|
||||
degToRad(8),
|
||||
degToRad(25),
|
||||
gunModel.pitch!,
|
||||
turretModel.yaw,
|
||||
gun.pitch!,
|
||||
turret.yaw,
|
||||
);
|
||||
|
||||
modelTransformEvent.dispatch({ pitch, yaw });
|
||||
|
||||
Reference in new issue
Block a user