mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 12:09:51 +02:00
feat: no duplicate armor peices
This commit is contained in:
1 parent
821076ae59
commit
d54c08dc4e
1 file changed
+7
-1
@@ -150,6 +150,7 @@ export function ArmorMesh({
|
|||||||
.applyQuaternion(event.object.getWorldQuaternion(new Quaternion()));
|
.applyQuaternion(event.object.getWorldQuaternion(new Quaternion()));
|
||||||
const angle = Math.acos(surfaceNormal.dot(shellNormal));
|
const angle = Math.acos(surfaceNormal.dot(shellNormal));
|
||||||
const shell = useDuel.getState().antagonist!.shell;
|
const shell = useDuel.getState().antagonist!.shell;
|
||||||
|
const indexedObjects = new Set<ArmorMeshUserData['type']>();
|
||||||
const intersections = event.intersections
|
const intersections = event.intersections
|
||||||
.filter(({ object }) => Boolean(object.userData.type))
|
.filter(({ object }) => Boolean(object.userData.type))
|
||||||
.map(
|
.map(
|
||||||
@@ -159,7 +160,12 @@ export function ArmorMesh({
|
|||||||
userData: ArmorMeshUserData;
|
userData: ArmorMeshUserData;
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
);
|
)
|
||||||
|
.filter(({ object }) => {
|
||||||
|
if (indexedObjects.has(object.userData.type)) return false;
|
||||||
|
indexedObjects.add(object.userData.type);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
const intersectionsTillFirstCoreArmor = intersections.slice(
|
const intersectionsTillFirstCoreArmor = intersections.slice(
|
||||||
0,
|
0,
|
||||||
intersections.findIndex(
|
intersections.findIndex(
|
||||||
|
|||||||
Reference in new issue
Block a user