Skip to content

Commit 3cf22a2

Browse files
committed
Fixing test and applying renames
1 parent 56464fa commit 3cf22a2

6 files changed

Lines changed: 17 additions & 10 deletions

File tree

src/__tests__/Pedestrians.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import {expect, test} from 'vitest';
33

44
import * as YUKA from 'yuka';
55

6-
import {NavMesh,} from '../extensions/Navigation.js';
6+
import {NavMesh,} from '../extensions/navigation.js';
77
import EntityManager from '../extensions/EntityManager.js';
88

99
import Agent from '../modules/Pedestrians/Agent.js';
10-
import {findBestNavmeshSpacing,} from '../modules/Pedestrians/utilities.js';
10+
import {findBestNavMeshPoint,} from '../modules/Pedestrians';
1111

1212
const AGENT_NUMBER = 5000;
1313
const AGENT_RADIUS = 0.35;
@@ -52,7 +52,7 @@ test('Spawning non-intersecting agents', () => {
5252

5353
const entity = new Agent(i);
5454
entity.active = true;
55-
const pos = findBestNavmeshSpacing(navMesh, entityManager.entities);
55+
const pos = findBestNavMeshPoint(navMesh, entityManager.entities);
5656
entity.position.copy(pos);
5757

5858
entityManager.add(entity);

src/modules/Pedestrians/States.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,16 @@ class WalkState extends State {
104104

105105
}
106106
//Check if agent reached end of their path
107-
if (follow.path.finished()) {
107+
if (follow && follow.path.finished()) {
108108
owner.setActive(false);
109109
}
110110
//If agent is trying to reach a point, disable FollowPath
111-
if (arrive.target != null) {
112-
follow.weight = 0;
113-
} else {
114-
follow.weight = 1;
111+
if (arrive) {
112+
if (arrive.target != null) {
113+
follow.weight = 0;
114+
} else {
115+
follow.weight = 1;
116+
}
115117
}
116118

117119
}

src/modules/Pedestrians/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as YUKA from 'yuka';
55

66
import GUI from '../../extensions/GUI.js';
77
import EntityManager from '../../extensions/EntityManager.js';
8-
import {NavMesh, Path,} from '../../extensions/Navigation.js';
8+
import {NavMesh, Path,} from '../../extensions/navigation.js';
99

1010
import {loadGLTF, loadTexture, rawTexture,} from '../../utilities/loaders.js';
1111

@@ -64,7 +64,7 @@ function renderInstance(entity, renderComponent, camera) {
6464

6565
}
6666

67-
export class Pedestrians {
67+
class Pedestrians {
6868

6969
constructor(stageData, camera, loadingManager) {
7070

@@ -260,3 +260,8 @@ export class Pedestrians {
260260
}
261261

262262
}
263+
264+
export {
265+
Pedestrians,
266+
findBestNavMeshPoint,
267+
};

0 commit comments

Comments
 (0)