Skip to content

Commit de53f39

Browse files
committed
Remove unused orientation state in components.
1 parent a938fe6 commit de53f39

2 files changed

Lines changed: 2 additions & 18 deletions

File tree

client/src/components/Pedestrian.jsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,12 @@ import * as THREE from 'three';
55
const Pedestrian = ({ pedestrian, coordinateTransformer }) => {
66
const { pos, state, id, color, satisfaction, resources } = pedestrian;
77
const [pedPosition, setPedPosition] = useState(null);
8-
const [orientation, setOrientation] = useState(new THREE.Quaternion());
98

109
useEffect(() => {
1110
if (coordinateTransformer) {
1211
const [lat, lng] = pos;
1312
const vector = coordinateTransformer.latLngToECEF(lat, lng, 1); // Elevate slightly
1413
setPedPosition(vector);
15-
16-
const up = vector.clone().normalize();
17-
const newOrientation = new THREE.Quaternion().setFromUnitVectors(
18-
new THREE.Vector3(0, 1, 0), // Default model's 'up'
19-
up // Target 'up' on the globe
20-
);
21-
setOrientation(newOrientation);
2214
}
2315
}, [pos, coordinateTransformer]);
2416

@@ -53,7 +45,7 @@ const Pedestrian = ({ pedestrian, coordinateTransformer }) => {
5345
const scale = 6; // Made slightly smaller to fit more pedestrians
5446

5547
return (
56-
<group position={pedPosition} quaternion={orientation}>
48+
<group position={pedPosition}>
5749
<group position={[0, 6, 0]}>
5850
{/* Head - colored by satisfaction */}
5951
<mesh position={[0, 0.75 * scale, 0]}>

client/src/components/TrafficLight.jsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,12 @@ import * as THREE from 'three';
44
const TrafficLight = ({ light, coordinateTransformer }) => {
55
const { pos, state } = light;
66
const [ecefPosition, setEcefPosition] = useState(null);
7-
const [orientation, setOrientation] = useState(new THREE.Quaternion());
87

98
useEffect(() => {
109
if (coordinateTransformer) {
1110
const [lat, lng] = pos;
1211
const vector = coordinateTransformer.latLngToECEF(lat, lng, 1);
1312
setEcefPosition(vector);
14-
15-
const up = vector.clone().normalize();
16-
const newOrientation = new THREE.Quaternion().setFromUnitVectors(
17-
new THREE.Vector3(0, 1, 0), // Default cylinder's 'up'
18-
up // Target 'up' on the globe
19-
);
20-
setOrientation(newOrientation);
2113
}
2214
}, [pos, coordinateTransformer]);
2315

@@ -26,7 +18,7 @@ const TrafficLight = ({ light, coordinateTransformer }) => {
2618
if (!ecefPosition) return null;
2719

2820
return (
29-
<group position={ecefPosition} quaternion={orientation}>
21+
<group position={ecefPosition}>
3022
<mesh position={[0, 15, 0]}>
3123
<cylinderGeometry args={[1, 1, 30, 12]} />
3224
<meshStandardMaterial color="#333333" />

0 commit comments

Comments
 (0)