mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
angles
This commit is contained in:
1 parent
f73ffc3c93
commit
1f767af0b5
9 files changed
+47
-41
No files matched your search
@@ -1,6 +1,5 @@
|
||||
import { memo, useRef } from "react";
|
||||
import { Group } from "three";
|
||||
import { correctZYTuple } from "../core/blitz/correctZYTuple";
|
||||
import { nameToArmorId } from "../core/blitzkit/nameToArmorId";
|
||||
import { resolveArmor } from "../core/blitzkit/resolveThickness";
|
||||
import { useArmor } from "../hooks/useArmor";
|
||||
@@ -8,6 +7,7 @@ import { useConsumable } from "../hooks/useConsumable";
|
||||
import { DuelModule, useDuel } from "../hooks/useDuel";
|
||||
import { useDuelModel } from "../hooks/useDuelModel";
|
||||
import { useTankTransform } from "../hooks/useTankTransform";
|
||||
import { toThreeVector } from "../three/toThreeVector";
|
||||
import { PrimaryArmorSceneComponent } from "./PrimaryArmorSceneComponent";
|
||||
|
||||
export const PrimaryArmorScene = memo(() => {
|
||||
@@ -23,9 +23,9 @@ export const PrimaryArmorScene = memo(() => {
|
||||
const trackModelDefinition = tankModelDefinition.tracks[track.id];
|
||||
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
||||
const gunModelDefinition = turretModelDefinition.guns[gun.id];
|
||||
const hullOrigin = correctZYTuple(trackModelDefinition.origin!);
|
||||
const turretOrigin = correctZYTuple(tankModelDefinition.turret_origin!);
|
||||
const gunOrigin = correctZYTuple(turretModelDefinition.gun_origin!);
|
||||
const hullOrigin = toThreeVector(trackModelDefinition.origin);
|
||||
const turretOrigin = toThreeVector(tankModelDefinition.turret_origin);
|
||||
const gunOrigin = toThreeVector(turretModelDefinition.gun_origin);
|
||||
const isDynamicArmorActive = useConsumable("protagonist", 73);
|
||||
|
||||
useTankTransform(track, turret, turretContainer, gunContainer);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { memo, useRef } from "react";
|
||||
import { Group, Plane, Scene, Vector3 } from "three";
|
||||
import { correctZYTuple } from "../core/blitz/correctZYTuple";
|
||||
import { nameToArmorId } from "../core/blitzkit/nameToArmorId";
|
||||
import { resolveArmor } from "../core/blitzkit/resolveThickness";
|
||||
import { useArmor } from "../hooks/useArmor";
|
||||
@@ -9,6 +8,7 @@ import { DuelModule, useDuel } from "../hooks/useDuel";
|
||||
import { useDuelModel } from "../hooks/useDuelModel";
|
||||
import { useModel } from "../hooks/useModel";
|
||||
import { useTankTransform } from "../hooks/useTankTransform";
|
||||
import { toThreeVector } from "../three/toThreeVector";
|
||||
import { SpacedArmorSceneComponent } from "./SpacedArmorSceneComponent";
|
||||
|
||||
export enum ArmorType {
|
||||
@@ -36,9 +36,9 @@ export const SpacedArmorScene = memo<SpacedArmorSceneProps>(({ scene }) => {
|
||||
const trackModelDefinition = tankModelDefinition.tracks[track.id];
|
||||
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
||||
const gunModelDefinition = turretModelDefinition.guns[gun.id];
|
||||
const hullOrigin = correctZYTuple(trackModelDefinition.origin!);
|
||||
const turretOrigin = correctZYTuple(tankModelDefinition.turret_origin!);
|
||||
const gunOrigin = correctZYTuple(turretModelDefinition.gun_origin!);
|
||||
const hullOrigin = toThreeVector(trackModelDefinition.origin);
|
||||
const turretOrigin = toThreeVector(tankModelDefinition.turret_origin);
|
||||
const gunOrigin = toThreeVector(turretModelDefinition.gun_origin);
|
||||
const maskOrigin =
|
||||
gunModelDefinition.mask === undefined
|
||||
? undefined
|
||||
|
||||
@@ -2,7 +2,6 @@ import { useThree, type ThreeEvent } from "@react-three/fiber";
|
||||
import { memo, useRef } from "react";
|
||||
import { Group, Plane, Vector2, Vector3 } from "three";
|
||||
import { applyPitchYawLimits } from "../core/blitz/applyPitchYawLimits";
|
||||
import { correctZYTuple } from "../core/blitz/correctZYTuple";
|
||||
import { modelTransformEvent } from "../core/blitzkit/modelTransform";
|
||||
import { nameToArmorId } from "../core/blitzkit/nameToArmorId";
|
||||
import { resolveArmor } from "../core/blitzkit/resolveThickness";
|
||||
@@ -16,6 +15,7 @@ import { useModel } from "../hooks/useModel";
|
||||
import { useTankTransform } from "../hooks/useTankTransform";
|
||||
import { Tankopedia } from "../stores/tankopedia";
|
||||
import { TankopediaPersistent } from "../stores/tankopediaPersistent";
|
||||
import { toThreeVector } from "../three/toThreeVector";
|
||||
import { ArmorType } from "./SpacedArmorScene";
|
||||
import { StaticArmorSceneComponent } from "./StaticArmorSceneComponent";
|
||||
|
||||
@@ -44,9 +44,9 @@ export const StaticArmor = memo<ArmorSceneProps>(({ thicknessRange }) => {
|
||||
const trackModelDefinition = tankModelDefinition.tracks[track.id];
|
||||
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
||||
const gunModelDefinition = turretModelDefinition.guns[gun.id];
|
||||
const hullOrigin = correctZYTuple(trackModelDefinition.origin!);
|
||||
const turretOrigin = correctZYTuple(tankModelDefinition.turret_origin!);
|
||||
const gunOrigin = correctZYTuple(turretModelDefinition.gun_origin!);
|
||||
const hullOrigin = toThreeVector(trackModelDefinition.origin);
|
||||
const turretOrigin = toThreeVector(tankModelDefinition.turret_origin);
|
||||
const gunOrigin = toThreeVector(turretModelDefinition.gun_origin);
|
||||
const canvas = useThree((state) => state.gl.domElement);
|
||||
|
||||
const maskOrigin =
|
||||
|
||||
@@ -22,6 +22,7 @@ export function TankModel() {
|
||||
const turretContainer = useRef<Group>(null!);
|
||||
const gunContainer = useRef<Group>(null!);
|
||||
const tankModelDefinition = useDuelModel("protagonist");
|
||||
const trackModelDefinition = tankModelDefinition.tracks[track.id];
|
||||
const turretModelDefinition = tankModelDefinition.turrets[protagonist.turret];
|
||||
const gunModelDefinition = turretModelDefinition.guns[protagonist.gun];
|
||||
const { gltf } = useModel(protagonist.tank);
|
||||
@@ -31,6 +32,18 @@ export function TankModel() {
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* <mesh
|
||||
scale={0.1}
|
||||
position={[
|
||||
trackModelDefinition.origin!.x + tankModelDefinition.turret_origin!.x,
|
||||
trackModelDefinition.origin!.y + tankModelDefinition.turret_origin!.y,
|
||||
trackModelDefinition.origin!.z + tankModelDefinition.turret_origin!.z,
|
||||
]}
|
||||
>
|
||||
<sphereGeometry />
|
||||
<meshBasicMaterial color="red" depthTest={false} />
|
||||
</mesh> */}
|
||||
|
||||
{nodes.map((node) => {
|
||||
const isHull = node.name === "hull";
|
||||
const isWheel = node.name.startsWith("chassis_wheel_");
|
||||
@@ -129,7 +142,7 @@ export function TankModel() {
|
||||
window.addEventListener("pointerup", handlePointerUp);
|
||||
}
|
||||
function handlePointerMove(event: PointerEvent) {
|
||||
const protagonist = useDuel("protagonist", DuelModule.Tank);
|
||||
const protagonist = getDuel("protagonist", DuelModule.Tank);
|
||||
|
||||
const hasImprovedVerticalStabilizer = hasEquipment(
|
||||
122,
|
||||
|
||||
+4
-4
@@ -1,12 +1,12 @@
|
||||
import { useRef } from "react";
|
||||
import { Group, ShaderMaterial, UniformsLib, UniformsUtils } from "three";
|
||||
import { correctZYTuple } from "../../../../../../../core/blitz/correctZYTuple";
|
||||
import { jsxTree } from "../../../../../../../core/blitzkit/jsxTree";
|
||||
import { useArmor } from "../../../../../../../hooks/useArmor";
|
||||
import { useModel } from "../../../../../../../hooks/useModel";
|
||||
import { useTankModelDefinition } from "../../../../../../../hooks/useTankModelDefinition";
|
||||
import { useTankTransform } from "../../../../../../../hooks/useTankTransform";
|
||||
import { Duel } from "../../../../../../../stores/duel";
|
||||
import { toThreeVector } from "../../../../../../../three/toThreeVector";
|
||||
import { ModelTankWrapper } from "../../../../../../ModelTankWrapper";
|
||||
import fragmentShader from "./shaders/fragment.glsl?raw";
|
||||
import vertexShader from "./shaders/vertex.glsl?raw";
|
||||
@@ -37,9 +37,9 @@ export function TransitionSkeleton() {
|
||||
const gunModelDefinition = turretModelDefinition.guns[gun.id];
|
||||
const trackModelDefinition = tankModelDefinition.tracks[track.id];
|
||||
const wrapper = useRef<Group>(null);
|
||||
const hullOrigin = correctZYTuple(trackModelDefinition.origin!);
|
||||
const turretOrigin = correctZYTuple(tankModelDefinition.turret_origin!);
|
||||
const gunOrigin = correctZYTuple(turretModelDefinition.gun_origin!);
|
||||
const hullOrigin = toThreeVector(trackModelDefinition.origin);
|
||||
const turretOrigin = toThreeVector(tankModelDefinition.turret_origin);
|
||||
const gunOrigin = toThreeVector(turretModelDefinition.gun_origin);
|
||||
|
||||
useTankTransform(track, turret, turretContainer, gunContainer);
|
||||
|
||||
|
||||
Reference in new issue
Block a user