[UE5] ๐Ÿค ์ƒํ˜ธ์ž‘์šฉ (3)

Singery00ยท2024๋…„ 4์›” 4์ผ
0

UE5 Blueprint

๋ชฉ๋ก ๋ณด๊ธฐ
15/29
post-thumbnail
post-custom-banner

๊ฐœ์š”

๐Ÿ’ก ์ด๋ฒˆ ํฌ์ŠคํŒ…์—์„œ๋Š” ์ž…๋ ฅ๊ณผ, ํŠธ๋ ˆ์ด์Šค๋ฅผ ์ด์šฉํ•œ ์•กํ„ฐ์™€์˜ ์ƒํ˜ธ์ž‘์šฉ์— ๋Œ€ํ•ด์„œ ์ž‘์„ฑํ•˜๊ฒ ๋‹ค.

์ƒํ˜ธ์ž‘์šฉ์„ ์œ„ํ•ด์„œ ์ •๋ง ๊ฐ„๋‹จํ•˜๊ฒŒ ๊ธฐ๋ณธ ๊ฐœ๋…์— ๋Œ€ํ•ด์„œ ์ตํ˜”์œผ๋‹ˆ ์ง์ ‘ ํ™œ์šฉํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

์ด๋ฒˆ ํฌ์ŠคํŒ…์—์„œ๋Š” ๋ฌธ์„ ์—ด์–ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

1. ์ƒํ˜ธ์ž‘์šฉ์„ ์œ„ํ•œ ๊ธฐ์ดˆ
2. Line Trace๋ฅผ ์‚ฌ์šฉํ•œ ์ƒํ˜ธ์ž‘์šฉ
3. Overlap Event๋ฅผ ์‚ฌ์šฉํ•œ ์ƒํ˜ธ์ž‘์šฉ
4. ์‘์šฉ


๋ณธ๋ก 


๐Ÿšช ๋ฌธ์—ด๊ธฐ

Overlap Event๋ฅผ ์ด์šฉํ•œ ์ƒํ˜ธ ์ž‘์šฉ์„ ํ†ตํ•ด ๋ฌธ์„ ์—ฌ๋Š” ๋กœ์ง์„ ๋งŒ๋“ค์–ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ๐Ÿ‘

ํ‚ค ๋งคํ•‘์€ ์ด์ „ ํฌ์ŠคํŒ…์—์„œ ๋“ฑ๋กํ•œ Eํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

Player ํƒœ๊ทธ ์„ค์ •

BP_Player์—๊ฒŒ ํƒœ๊ทธ๋ฅผ ์„ค์ •ํ•ด์ฃผ๊ฒ ์Šต๋‹ˆ๋‹ค.

  1. Components์—์„œ BP_Player๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.
  2. Details์—์„œ tag๊ฒ€์ƒ‰
  3. Actor์„น์…˜์—์„œ ํƒœ๊ทธ ์ถ”๊ฐ€ ํ›„ Player๋กœ ์„ค์ •

Door ๋ธ”๋ฃจํ”„๋ฆฐํŠธ ํด๋ž˜์Šค ์ƒ์„ฑ

์ด์ œ ๋ฌธ์„ ๋งŒ๋“ค์–ด ๋ด…์‹œ๋‹ค.
Actor๋กœ BP_Door ๋งŒ๋“ค์–ด ์ค์‹œ๋‹ค.

๋ฉ”์‹œ ์ถ”๊ฐ€

Static Mesh ์ปดํฌ๋„ŒํŠธ ์ถ”๊ฐ€ํ•ด์ฃผ๊ณ  ๋ฌธ Mesh๋ฅผ ๋„ฃ์–ด์ค์‹œ๋‹ค.

Box Collision ์ถ”๊ฐ€

Door์˜ ํ•˜์œ„์— Box Collision์„ ์ถ”๊ฐ€ํ•ด์ค์‹œ๋‹ค.

๊ทธ๋ฆฌ๊ณ  ์ ์ ˆํžˆ ์นธ์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

Overlap Event ์ถ”๊ฐ€

Component์—์„œ Box๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.
Details์—์„œ Events๋ฅผ ๊ฒ€์ƒ‰ํ•ด์ฃผ์‹œ๊ณ  ์•„๋ž˜ 2๊ฐ€์ง€ ์ด๋ฒคํŠธ๋ฅผ ์ถ”๊ฐ€ํ•ด์ฃผ์„ธ์š”.

  1. Begin Overlap Event
  2. End Overlap Event

ํƒœ๊ทธ๋กœ ๊ตฌ๋ถ„ํ•˜๊ธฐ

๊ฐ Overlap ์ด๋ฒคํŠธ๋ฅผ ์„ค๋ช…ํ•˜๋ฉด Begin์€ ๊ฒน์น˜๊ฒŒ ๋œ ์ˆœ๊ฐ„, End๋Š” ๊ฒน์น˜์ง€ ์•Š๊ฒŒ ๋œ ์ˆœ๊ฐ„์— ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

๊ฐ Other Actor์—์„œ Actor Has Tag๋ฅผ ๊ฐ€์ ธ์™€์„œ Player๋กœ ์„ค์ •ํ•ด์ค๋‹ˆ๋‹ค.

๊ทธ๋ฆฌ๊ณ  Branch๋ฅผ ์ด์–ด์„œ ์ถœ๋ ฅํ•ด์„œ ํ™•์ธํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

โ—์ปดํŒŒ์ผ ์ €์žฅโ—ํ›„ ํ”Œ๋ ˆ์ด ํ•ด๋ณด๋ฉด ์บ๋ฆญํ„ฐ๊ฐ€ ์ฒ˜์Œ ๋‹ฟ์„ ๋•Œ Begin, ๋‚˜๊ฐˆ ๋•Œ End๊ฐ€ ์ถœ๋ ฅ๋˜๋Š”๊ฑธ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋ณ€์ˆ˜ ์„ค์ •

ํ”Œ๋ ˆ์ด์–ด๋ฅผ ๊ฐ์ง€ํ–ˆ์œผ๋‹ˆ ์ƒํƒœ๋ฅผ ์ €์žฅํ•  ๋ณ€์ˆ˜๋ฅผ ํ•˜๋‚˜ ์ฃผ๊ฒ ์Šต๋‹ˆ๋‹ค.
isPlayer๋ผ๋Š” Bool๋ณ€์ˆ˜๋ฅผ ๋งŒ๋“ค์–ด Begin์ผ ๋•Œ True, End์ผ ๋•Œ False๊ฐ€ ๋˜๋„๋ก ์„ค์ •ํ•ด์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค.

BP_Player ๋กœ์ง ์„ค์ •

BP_Player์˜ Event Graph๋กœ ๊ฐ‘๋‹ˆ๋‹ค.

IA_Interact์—์„œ Get Actor Of Class ๋…ธ๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.
๊ทธ๋ฆฌ๊ณ  ์•„๋ž˜์˜ Actor Class๋ฅผ BP_Door๋กœ ๋ณ€๊ฒฝํ•ฉ๋‹ˆ๋‹ค.

Return Value๋ฅผ ๋Œ์–ด์„œ Get isPlayer๋ฅผ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.

isPlayer๊ฐ€ True์ผ ๋•Œ ๋ฌธ์ด ์—ด๋ฆฌ๋ฉด ๋˜๊ฒ ์ฃ ?

Branch๋ฅผ ์ด์–ด์„œ Line Trace๋•Œ์™€ ๋™์ผํ•œ ๋กœ์ง์„ ํ•ด์ค๋‹ˆ๋‹ค.

โ—์ปดํŒŒ์ผ ์ €์žฅโ—ํ›„ ํ”Œ๋ ˆ์ดํ•ด๋ณด๋ฉด ๋ฌธ์ด ์—ด๋ฆฌ๋Š”๊ฑธ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
ํ•˜์ง€๋งŒ ์„ค์ •ํ•œ Box์˜ ๋ฒ”์œ„ ๋ฐ–์„ ๋ฒ—์–ด๋‚˜๋ฉด ์•„๋ฌด๋ฆฌ Eํ‚ค๋ฅผ ๋ˆŒ๋Ÿฌ๋„ ๋ฌธ์ด ์—ด๋ฆฌ์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

๋ฒŒ์ปฅ ์—ด๋ฆฌ๋„ค์š”.

False์ผ ๋•Œ๋Š” ๋‹ค์‹œ 0์œผ๋กœ Set ํ•ด์ฃผ๋ฉด ๋ฌธ์ด ๋‹ค์‹œ ๋‹ซํžˆ๊ฒ ๋„ค์š”


๋งˆ๋ฌด๋ฆฌ

์ด๊ฒƒ์œผ๋กœ Overlap Event๋ฅผ ์‚ฌ์šฉํ•œ ์ƒํ˜ธ์ž‘์šฉ๊นŒ์ง€ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

Line Trace์™€ Overlap Event ๋ชจ๋‘ ๊ฐ„๋‹จํ•˜๊ฒŒ ์„ค๋ช…ํ–ˆ์ง€๋งŒ ๊ฐ์ž์˜ ๋กœ์ง์„ ์ž‘์„ฑํ•ด์„œ ์•„์ฃผ ๊ฐ•๋ ฅํ•˜๊ฒŒ ๊ธฐ๋Šฅํ•˜๋„๋ก๋งŒ๋“ค ์ˆ˜ ์žˆ๊ฒ ์ฃ .

์ด ๊ธฐ๋Šฅ๋“ค์€ ์‘์šฉํ•ด์„œ ๋‹ค์Œ ํฌ์ŠคํŒ…์—๋Š” ์•„๋ž˜ ๊ธฐ๋Šฅ๋“ค์„ ๊ตฌํ˜„ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

  1. ์ด์œผ๋กœ ์ ์—๊ฒŒ ํ”ผํ•ด์ฃผ๊ธฐ
  2. ์•„์ดํ…œ ํš๋“

1. ์ƒํ˜ธ์ž‘์šฉ์„ ์œ„ํ•œ ๊ธฐ์ดˆ
2. Line Trace๋ฅผ ์‚ฌ์šฉํ•œ ์ƒํ˜ธ์ž‘์šฉ
3. Overlap Event๋ฅผ ์‚ฌ์šฉํ•œ ์ƒํ˜ธ์ž‘์šฉ
4. ์‘์šฉ

profile
๊ฒŒ์ž„ ๊ฐœ๋ฐœ์ž๊ฐ€ ๋˜์–ด๋ณด์ž
post-custom-banner

0๊ฐœ์˜ ๋Œ“๊ธ€