Skip to content

Commit

Permalink
Set line material colour too.
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwardMoyse committed Nov 30, 2024
1 parent b512fcb commit 2c96966
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import {
Color,
MeshPhongMaterial,
LineBasicMaterial,
Mesh,
Object3D,
Material,
type Object3DEventMap,
Line,
} from 'three';
import { SceneManager } from './scene-manager';

Expand Down Expand Up @@ -133,5 +135,11 @@ function setColorForObject(object: Object3D<Object3DEventMap>, color: any) {
} else if ('color' in material) {
(material.color as Color).set(color);
}
} else if (object instanceof Line) {
const line = object as Line;
const material = line.material;
if ('color' in material) {
(material.color as Color).set(color);
}
}
}

0 comments on commit 2c96966

Please sign in to comment.