Fix mirrored elevator indicators and arrows
This commit is contained in:
@@ -294,11 +294,13 @@ function BoxPrimitive({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function MeshButtonLabel({
|
function MeshButtonLabel({
|
||||||
|
faceSign = 1,
|
||||||
label,
|
label,
|
||||||
material,
|
material,
|
||||||
position,
|
position,
|
||||||
scale,
|
scale,
|
||||||
}: {
|
}: {
|
||||||
|
faceSign?: -1 | 1
|
||||||
label: string
|
label: string
|
||||||
material: MeshStandardMaterial
|
material: MeshStandardMaterial
|
||||||
position: [number, number, number]
|
position: [number, number, number]
|
||||||
@@ -315,7 +317,7 @@ function MeshButtonLabel({
|
|||||||
const props = SEGMENT_PROPS[segment]
|
const props = SEGMENT_PROPS[segment]
|
||||||
return {
|
return {
|
||||||
position: [
|
position: [
|
||||||
startX + charIndex * spacing + props.position[0] * scale,
|
faceSign * (startX + charIndex * spacing + props.position[0] * scale),
|
||||||
props.position[1] * scale,
|
props.position[1] * scale,
|
||||||
props.position[2],
|
props.position[2],
|
||||||
] as Vector3Tuple,
|
] as Vector3Tuple,
|
||||||
@@ -323,7 +325,7 @@ function MeshButtonLabel({
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
}, [label, scale])
|
}, [faceSign, label, scale])
|
||||||
|
|
||||||
const applyInstanceMatrices = useCallback(
|
const applyInstanceMatrices = useCallback(
|
||||||
(mesh: InstancedMesh) => {
|
(mesh: InstancedMesh) => {
|
||||||
@@ -381,7 +383,7 @@ function ElevatorDirectionGlyph({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const ySign = direction === 'up' ? 1 : -1
|
const ySign = direction === 'up' ? -1 : 1
|
||||||
return (
|
return (
|
||||||
<group position={position}>
|
<group position={position}>
|
||||||
<BoxPrimitive
|
<BoxPrimitive
|
||||||
@@ -443,13 +445,14 @@ function ElevatorFloorIndicator({
|
|||||||
<ElevatorDirectionGlyph
|
<ElevatorDirectionGlyph
|
||||||
direction={direction}
|
direction={direction}
|
||||||
material={glyphMaterial}
|
material={glyphMaterial}
|
||||||
position={[-0.115 * scale, 0, glyphZ]}
|
position={[-0.115 * faceSign * scale, 0, glyphZ]}
|
||||||
scale={scale}
|
scale={scale}
|
||||||
/>
|
/>
|
||||||
<MeshButtonLabel
|
<MeshButtonLabel
|
||||||
|
faceSign={faceSign}
|
||||||
label={displayLabel}
|
label={displayLabel}
|
||||||
material={glyphMaterial}
|
material={glyphMaterial}
|
||||||
position={[0.075 * scale, 0, glyphZ]}
|
position={[0.075 * faceSign * scale, 0, glyphZ]}
|
||||||
scale={0.055 * scale}
|
scale={0.055 * scale}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
@@ -594,6 +597,7 @@ function ElevatorMeshButton({
|
|||||||
/>
|
/>
|
||||||
{label && (
|
{label && (
|
||||||
<MeshButtonLabel
|
<MeshButtonLabel
|
||||||
|
faceSign={faceSign}
|
||||||
label={label}
|
label={label}
|
||||||
material={labelMaterial}
|
material={labelMaterial}
|
||||||
position={[0, 0, faceZ]}
|
position={[0, 0, faceZ]}
|
||||||
|
|||||||
Reference in New Issue
Block a user