forked from phenom/healer-man
Release Healer Man 0.1.34
This commit is contained in:
1 parent
05b25c4341
commit
46c272f889
19 files changed
+568
-121
No files matched your search
@@ -4,6 +4,8 @@ import {
|
||||
Mesh,
|
||||
type Object3D,
|
||||
} from "three";
|
||||
import type { DungeonTraversalRamp } from "../game/dungeonTypes";
|
||||
import { smoothDungeonStairGeometry } from "../game/dungeonTraversalRamps";
|
||||
|
||||
export interface PreparedCollisionTrimesh {
|
||||
readonly id: string;
|
||||
@@ -15,7 +17,7 @@ export interface PreparedCollisionTrimesh {
|
||||
// This deliberately rejects floors, ramps, slopes, and ceilings.
|
||||
const MAX_SIGHT_BLOCKER_NORMAL_Y = 0.5;
|
||||
|
||||
export function prepareCollision(root: Object3D): Group {
|
||||
export function prepareCollision(root: Object3D, ramps: readonly DungeonTraversalRamp[] = []): Group {
|
||||
root.updateWorldMatrix(true, true);
|
||||
const inverseRootMatrix = root.matrixWorld.clone().invert();
|
||||
const prepared = new Group();
|
||||
@@ -40,6 +42,7 @@ export function prepareCollision(root: Object3D): Group {
|
||||
);
|
||||
}
|
||||
geometry.applyMatrix4(inverseRootMatrix.clone().multiply(mesh.matrixWorld));
|
||||
if (ramps.length) smoothDungeonStairGeometry(geometry, ramps);
|
||||
const preparedMesh = new Mesh(geometry, mesh.material);
|
||||
preparedMesh.name = mesh.name;
|
||||
preparedMesh.visible = false;
|
||||
|
||||
Reference in new issue
Block a user