fix: negative hard joint handling... correctly this time

This commit is contained in:
TrèsAbhi committed 2024-01-12 20:20:51 -06:00
1 parent 062e6e9626
commit 0582339332
4 files changed
+30 -20

No files matched your search

+1 -4
View File
@@ -58,10 +58,7 @@ export async function extractArmor(data: string, fileName: string) {
attributes.get(attribute)!.push(value);
if (
attribute === VertexAttribute.HARD_JOINTINDEX &&
value[0] !== -1
) {
if (attribute === VertexAttribute.HARD_JOINTINDEX) {
hardJointIndices.add(value[0]);
vertexHardJointIndices.set(index, value[0]);
}
+1 -1
View File
@@ -1,5 +1,5 @@
export function nameToArmorId(name: string) {
const match = name.match(/.+_armor_(\d+)/);
const match = name.match(/.+_armor_(-?\d+)/);
const group1 = match![1];
return parseInt(group1);
+8
View File
@@ -0,0 +1,8 @@
import { ModelArmor } from './modelDefinitions';
export function resolveArmor(armor: ModelArmor, index: number) {
const spaced = armor.spaced?.includes(index) ?? false;
const thickness = index === -1 ? 0 : armor.thickness[index] ?? 0;
return { spaced, thickness };
}