Skip to content

Commit

Permalink
new light mouse trail
Browse files Browse the repository at this point in the history
  • Loading branch information
mbodge committed Sep 27, 2024
1 parent 03d5d67 commit 6866af6
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions apps/web/src/components/ThreeHero/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -479,14 +479,27 @@ function PhysicsMesh({

function Pointer({ vec = new THREE.Vector3() }) {
const ref = useRef();
const light = useRef();
useFrame(({ mouse, viewport }) => {
ref.current?.setNextKinematicTranslation(
vec.set((mouse.x * viewport.width) / 2, (mouse.y * viewport.height) / 2, 0),
);
light.current?.position.set(
//(mouse.x * viewport.width) / 2,
//(mouse.y * viewport.height) / 2,
0,
0,
10,
);
light.current?.lookAt((mouse.x * viewport.width) / 2, (mouse.y * viewport.height) / 2, 0);
});
return (
<RigidBody position={[0, 0, 0]} type="kinematicPosition" colliders={false} ref={ref}>
<BallCollider args={[2]} />
</RigidBody>
<>
<RigidBody position={[0, 0, 0]} type="kinematicPosition" colliders={false} ref={ref}>
<BallCollider args={[2]} />
</RigidBody>

<directionalLight ref={light} position={[0, 0, 10]} intensity={18} color={blue} />
</>
);
}

0 comments on commit 6866af6

Please sign in to comment.