Skip to content

Commit

Permalink
Fix sidewalk width
Browse files Browse the repository at this point in the history
  • Loading branch information
ewei2406 committed Dec 22, 2024
1 parent 77da804 commit eeaf9e0
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions src/components/intersection.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,43 +126,45 @@ AFRAME.registerComponent('intersection', {
// describe sidewalk parameters
const sidewalkParams = {
west: {
positionVec: { x: -intersectWidth / 2 + sidewalkArray[0] / 2, z: 0.1 },
rotationVec: { x: 90, y: 0, z: 0 },
length: intersectDepth,
width: sidewalkArray[0],
positionVec: {
x: -intersectWidth / 2,
y: -intersectWidth / 2,
z: 0.1
},
width: intersectDepth,
length: sidewalkArray[0],
displayName: 'West'
},
east: {
positionVec: { x: intersectWidth / 2 - sidewalkArray[1] / 2, z: 0.1 },
rotationVec: { x: 90, y: 0, z: 0 },
length: intersectDepth,
width: sidewalkArray[1],
positionVec: {
x: intersectWidth / 2,
y: -intersectWidth / 2,
z: 0.1
},
scaleVec: { x: -1, y: 1, z: 1 },
width: intersectDepth,
length: sidewalkArray[1],
displayName: 'East'
},
north: {
positionVec: {
// add x offset to avoid sidewalk's element overlap
x: sidewalkArray[1] / 2 - sidewalkArray[0] / 2,
y: intersectDepth / 2 - sidewalkArray[2] / 2,
x: -intersectWidth / 2,
y: intersectWidth / 2,
z: 0.1
},
rotationVec: { x: 0, y: 90, z: -90 },
// minus the width of the crossing sidewalk
length: intersectWidth - sidewalkArray[1] - sidewalkArray[0],
scaleVec: { x: 1, y: -1, z: 1 },
width: sidewalkArray[2],
length: intersectDepth,
displayName: 'North'
},
south: {
positionVec: {
// add x offset to avoid sidewalk's element overlap
x: sidewalkArray[1] / 2 - sidewalkArray[0] / 2,
y: -intersectDepth / 2 + sidewalkArray[3] / 2,
x: -intersectWidth / 2,
y: -intersectWidth / 2,
z: 0.1
},
rotationVec: { x: 0, y: 90, z: -90 },
// minus the width of the crossing sidewalk
length: intersectWidth - sidewalkArray[1] - sidewalkArray[0],
width: sidewalkArray[3],
length: intersectDepth,
displayName: 'South'
}
};
Expand Down

0 comments on commit eeaf9e0

Please sign in to comment.