Skip to content

Commit

Permalink
feat: refactor playcanvas helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
isaac-mason committed Oct 9, 2024
1 parent 338f92b commit 4d6851a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export class CrowdHelper extends GraphNode {
} else {
const material = new StandardMaterial();
material.diffuse.set(1, 0, 0);

this.agentMaterial = material;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Obstacle, TileCache } from '@recast-navigation/core';
import {
Color,
Entity,
Material,
RENDERSTYLE_WIREFRAME,
StandardMaterial,
Vec3,
Expand All @@ -11,7 +12,7 @@ import {
* Parameters for creating TileCacheHelper.
*/
export type TileCacheHelperParams = {
obstacleMaterial?: StandardMaterial;
obstacleMaterial?: Material;
};

/**
Expand All @@ -20,7 +21,7 @@ export type TileCacheHelperParams = {
export class TileCacheHelper extends Entity {
tileCache: TileCache;
obstacleMeshes = new Map<Obstacle, Entity>();
obstacleMaterial: StandardMaterial;
obstacleMaterial: Material;

constructor(tileCache: TileCache, params?: TileCacheHelperParams) {
super();
Expand All @@ -31,9 +32,10 @@ export class TileCacheHelper extends Entity {
if (params?.obstacleMaterial) {
this.obstacleMaterial = params.obstacleMaterial;
} else {
this.obstacleMaterial = new StandardMaterial();
this.obstacleMaterial.diffuse = new Color(1, 0, 0); // Red color
this.obstacleMaterial.update();
const material = new StandardMaterial();
material.diffuse = new Color(1, 0, 0); // Red color
material.update();
this.obstacleMaterial = material;
}

this.updateHelper();
Expand Down

0 comments on commit 4d6851a

Please sign in to comment.