Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 학습 내용 요약
three,@react-three/fiber,@react-three/drei,gsap패키지를 설치해 3D 웹을 구현할 수 있습니다.<OrthographicCamera>를 사용하여 원근감이 없는 쿼터뷰 시점을 설정하고<OrbitControls>를 통해 줌 인/아웃 및 각도 조절 기능을 설정할 수 있습니다.requestAnimationFrame을 사용해 자연스러운 점프 로직과 착지 이펙트를 구현했습니다.📁 실습 파일 설명
Player.tsx
useGLTF를 통해 3D 캐릭터 모델을 불러와<primitive>컴포넌트로 렌더링했습니다.useCallback을 사용하여 렌더링 시마다 그림자 및 애니메이션 설정이 초기화되지 않도록 최적화 적용했습니다.useFrame훅을 사용하여 매 프레임마다AnimationMixer를 업데이트해 캐릭터의 움직임을 구현했습니다. (시작, 정지, 루프, 한번재생등 가양한 기능을 제공)Light.tsx
<ambientLight>태그로 공간 전체에 부드럽게 퍼지는 기본 조명을intensity로 조절했습니다.<directionalLight>광원의 위치(position)와 강도를 설정하고castShadow를 통해 그림자 생성했습니다.DirectionalLightHelper로 조명을 제어할 수 있습니다.CameraController.tsx
Floor.tsx
<planeGeometry>로 바닥의 크기와rotation-x를 적용해 수평으로 배치했습니다.<mesh>에receiveShadow속성으로 Player 객체에서 생성되는 그림자가 바닥에 그려지도록 구현했습니다.usePlayerJump.ts
requestAnimationFrame과Math.sin함수를 활용하여 자연스러운 포물선 형태의 점프 움직임을 구현했습니다.🌟 느낀 점 및 피드백 요청 사항
children을 암시적으로 포함하는 등 타입 안정성을 떨어뜨릴 수 있기에 Props 타입을 명시적으로 지정하는 방식이 더 안전하다는 것을 알 수 있었습니다.useCallback을 남발했었는데 코드리뷰로 무분별한 최적화는 더 성능이 저하된다는 댓글을 받게되었는데 실습책에서도 관련된 내용이 작성되어 있어 다시한번 짚어넘어가는 계기가 되었습니다.