Skip to content

Commit

Permalink
Revert "fix: enable positive Y positioning in ContactShadows (#1547)"
Browse files Browse the repository at this point in the history
This reverts commit 807d530.
  • Loading branch information
drcmda committed Jul 3, 2023
1 parent 2fedb36 commit 6448355
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .storybook/stories/ContactShadows.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ function ContactShadowScene({ colorized }: any) {
<meshBasicMaterial color="#2A8AFF" />
</Sphere>
<ContactShadows
position={[0, 0.01, 0]}
position={[0, 0, 0]}
scale={10}
far={3}
blur={3}
rotation={[Math.PI / 2, 0, 0]}
color={colorized ? '#2A8AFF' : 'black'}
/>
<Plane args={[10, 10]} position={[0, 0, 0]} rotation={[-Math.PI / 2, 0, 0]}>
<Plane args={[10, 10]} position={[0, -0.01, 0]} rotation={[-Math.PI / 2, 0, 0]}>
<meshBasicMaterial color="white" />
</Plane>
</>
Expand Down
9 changes: 1 addition & 8 deletions src/core/ContactShadows.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ export const ContactShadows = React.forwardRef(
const scene = useThree((state) => state.scene)
const gl = useThree((state) => state.gl)
const shadowCamera = React.useRef<THREE.OrthographicCamera>(null!)
const { position } = props
const shadowCameraZ =
typeof position === 'number' ? position : Array.isArray(position) ? position[1] : position?.y || 0

width = width * (Array.isArray(scale) ? scale[0] : scale || 1)
height = height * (Array.isArray(scale) ? scale[1] : scale || 1)
Expand Down Expand Up @@ -152,11 +149,7 @@ export const ContactShadows = React.forwardRef(
<mesh renderOrder={renderOrder} geometry={planeGeometry} scale={[1, -1, 1]} rotation={[-Math.PI / 2, 0, 0]}>
<meshBasicMaterial transparent map={renderTarget.texture} opacity={opacity} depthWrite={depthWrite} />
</mesh>
<orthographicCamera
ref={shadowCamera}
args={[-width / 2, width / 2, height / 2, -height / 2, 0, far]}
position-z={shadowCameraZ}
/>
<orthographicCamera ref={shadowCamera} args={[-width / 2, width / 2, height / 2, -height / 2, 0, far]} />
</group>
)
}
Expand Down

1 comment on commit 6448355

@vercel
Copy link

@vercel vercel bot commented on 6448355 Jul 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.