mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 19:19:52 +02:00
feat: bounding boxes
This commit is contained in:
1 parent
9141f3d63f
commit
72a24b2770
5 files changed
+37
-7
No files matched your search
@@ -29,6 +29,7 @@ import {
|
||||
Tier,
|
||||
} from '../../src/core/blitzkrieg/tankDefinitions';
|
||||
import { DATA, POI } from './constants';
|
||||
import { TankParameters } from './tankIcons';
|
||||
|
||||
type BlitzTankType = 'AT-SPG' | 'lightTank' | 'mediumTank' | 'heavyTank';
|
||||
interface Strings {
|
||||
@@ -119,6 +120,9 @@ interface VehicleDefinitions {
|
||||
yawLimits: string | string[];
|
||||
gunPosition: string | string[];
|
||||
models: { undamaged: string };
|
||||
hitTester: {
|
||||
collisionModel: string;
|
||||
};
|
||||
guns: {
|
||||
[key: string]: {
|
||||
armor: VehicleDefinitionArmor & {
|
||||
@@ -338,6 +342,9 @@ export async function definitions(production: boolean) {
|
||||
const tankDefinition = await readXMLDVPL<{ root: VehicleDefinitions }>(
|
||||
`${DATA}/${POI.vehicleDefinitions}/${nation}/${tankKey}.xml.dvpl`,
|
||||
);
|
||||
const tankParameters = await readYAMLDVPL<TankParameters>(
|
||||
`${DATA}/${POI.tankParameters}/${nation}/${tankKey}.yaml.dvpl`,
|
||||
);
|
||||
const defaultChassis = Object.values(tankDefinition.root.chassis).at(
|
||||
-1,
|
||||
)!;
|
||||
@@ -426,6 +433,7 @@ export async function definitions(production: boolean) {
|
||||
roll: tankDefinition.root.hull.turretInitialRotation.roll,
|
||||
}
|
||||
: undefined,
|
||||
boundingBox: tankParameters.collision.hull.bbox,
|
||||
turrets: {},
|
||||
};
|
||||
|
||||
@@ -507,6 +515,10 @@ export async function definitions(production: boolean) {
|
||||
? undefined
|
||||
: { min: turretYaw[0], max: turretYaw[1] },
|
||||
guns: {},
|
||||
boundingBox:
|
||||
tankParameters.collision[
|
||||
parsePath(turret.hitTester.collisionModel).name.toLowerCase()
|
||||
].bbox,
|
||||
};
|
||||
|
||||
Object.keys(turret.guns).forEach((gunKey, gunIndex) => {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { readdir } from 'fs/promises';
|
||||
import { Vector3Tuple } from 'three';
|
||||
import { NATION_IDS } from '../../src/constants/nations';
|
||||
import { readBase64DVPL } from '../../src/core/blitz/readBase64DVPL';
|
||||
import { readXMLDVPL } from '../../src/core/blitz/readXMLDVPL';
|
||||
@@ -14,6 +15,16 @@ export interface TankParameters {
|
||||
bigIconPath: string;
|
||||
blitzModelPath: string;
|
||||
};
|
||||
collision: {
|
||||
[key: string]: {
|
||||
points: Vector3Tuple;
|
||||
bbox: {
|
||||
min: Vector3Tuple;
|
||||
max: Vector3Tuple;
|
||||
};
|
||||
averageThickness?: Record<string, number>;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export async function buildTankIcons(production: boolean) {
|
||||
|
||||
Reference in new issue
Block a user