[UE5] ๐Ÿƒโ€โ™‚ ์• ๋‹ˆ๋ฉ”์ด์…˜ ์ ์šฉ (2)

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

UE5 Blueprint

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

๊ฐœ์š”

๐Ÿ’ก ์ง€๋‚œ๋ฒˆ Old Input System๊ณผ Enhanced Input System์„ ๊ฐ๊ฐ ์ด์šฉํ•˜์—ฌ 3์ธ์นญ ์บ๋ฆญํ„ฐ๋ฅผ ์กฐ์ž‘ํ•  ์ˆ˜ ์žˆ๋„๋ก ๊ตฌํ˜„ํ•˜์˜€๋‹ค.
์ด๋ฒˆ์—” ํ•ด๋‹น ์บ๋ฆญํ„ฐ์— ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์ ์šฉํ•ด ์ข€ ๋” ์—ญ๋™์ ์ธ ํšจ๊ณผ๋ฅผ ์ค˜๋ณด๊ฒ ๋‹ค.

์ €๋ฒˆ ํฌ์ŠคํŒ…์—์„œ Idle๊ณผ Run์ƒํƒœ ์ „ํ™˜๊นŒ์ง€ ์™„๋ฃŒํ•˜์˜€๋‹ค.
์ด๋ฒˆ์—๋Š” ์ด์–ด์„œ Jump์ƒํƒœ๋ฅผ ๋งŒ๋“ค์–ด ๋ณด๊ฒ ๋‹ค.

1. ์• ๋‹ˆ๋ฉ”์ด์…˜ ๋ธ”๋ฃจํ”„๋ฆฐํŠธ ์ƒ์„ฑ
2. State Machine ์ถ”๊ฐ€
3. ์ •์ง€
4. ๋‹ฌ๋ฆฌ๊ธฐ
5. ์ ํ”„
6. ๊ฐœ์„ 

์–ธ๋ฆฌ์–ผ ์—”์ง„5 ์• ๋‹ˆ๋ฉ”์ด์…˜ ๋ธ”๋ฃจํ”„๋ฆฐํŠธ ๊ณต์‹ ๋ฌธ์„œ

์–ธ๋ฆฌ์–ผ ์—”์ง„5 ์• ๋‹ˆ๋ฉ”์ด์…˜ ์—๋””ํ„ฐ ๊ณต์‹ ๋ฌธ์„œ

โ—์ด์ „ ํฌ์ŠคํŒ…์—์„œ ์ œ์ž‘ํ•œ 3์ธ์นญ ์บ๋ฆญํ„ฐ๋ฅผ ์ด์–ด์„œ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹คโ—
โ—์—”์ง„์—์„œ ํŽธ์˜๋ฅผ ์ œ๊ณตํ•˜๊ธฐ ์œ„ํ•ด ์ž๋™์œผ๋กœ ์„ค์ •๋˜๋Š” ๊ฒฝ์šฐ๋„ ๋ชจ๋‘ ์„ค๋ช…ํ•˜๋‹ˆ ์ฐธ๊ณ ๋ฐ”๋ž๋‹ˆ๋‹คโ—


๋ณธ๋ก 


์ƒํƒœ ์ „ํ™˜ ํ๋ฆ„ ์—ฐ๊ฒฐ

Jump์ƒํƒœ์ธ ๊ฒƒ์„ ์•Œ ์ˆ˜ ์žˆ๋Š” ์กฐ๊ฑด์—๋Š” ๋ญ๊ฐ€ ์žˆ์„๊นŒ?

  1. Space๋ฐ” ์ž…๋ ฅ ์‹œ
  2. ๊ณต์ค‘์ผ ๋•Œ
    ๋“ฑ๋“ฑ..

์—ฌ๋Ÿฌ๊ฐ€์ง€ ์กฐ๊ฑด๋“ค์ด ์žˆ์„ํ…๋ฐ ์šฐ๋ฆฌ๋Š” 2๋ฒˆ ์กฐ๊ฑด. ๊ณต์ค‘์ผ ๋•Œ๋ฅผ ํŒ๋‹จํ•˜๊ฒ ๋‹ค.


Jump ์กฐ๊ฑด ๋ณ€์ˆ˜ ์ƒ์„ฑ

ABP_Player ์—๋””ํ„ฐ๋ฅผ ์ผœ์„œ isJump ๋ณ€์ˆ˜๋ฅผ Booleanํ˜•์œผ๋กœ ์ƒ์„ฑํ•ด์ฃผ์ž.

๊ทธ๋ฆฌ๊ณ  Event Graph๋กœ ์ด๋™ํ•ด์„œ ์ด์–ด์„œ ๋งŒ๋“ค์–ด๋ณด์ž.

Try Get Pawn Owner๋…ธ๋“œ์˜ ๋ฐ˜ํ™˜๊ฐ’์„ ๋Œ์–ด์„œ Cast To BP_Player๋…ธ๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜์ž.

Cast To BP_Player๋…ธ๋“œ์˜ As BP Player๋ฅผ ๋Œ์–ด์„œ Get Character Movement๋…ธ๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜์ž.

Get Character Movement๋…ธ๋“œ์˜ Character Movement๋ฅผ ๋Œ์–ด์„œ Is Falling๋…ธ๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜์ž.

์œ„ ๋…ธ๋“œ๋ฅผ ํ†ตํ•ด์„œ ์บ๋ฆญํ„ฐ์˜ Z ์ •๋ณด๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ๋‹ค.

๊ทธ๋ฆฌ๊ณ  ์ƒ์„ฑํ–ˆ๋˜ isJump๋ณ€์ˆ˜์˜ Set๋…ธ๋“œ๋ฅผ ๊ฐ€์ ธ์˜ค์ž.

Is Falling์˜ ๋ฐ˜ํ™˜๊ฐ’์„ ์—ฐ๊ฒฐํ•˜๊ณ , ์ €๋ฒˆ ํฌ์ŠคํŒ…์—์„œ ์ด์€ Set Speed๋…ธ๋“œ์˜ ํ๋ฆ„์„ ๋จผ์ € Cast to BP_Player๋กœ ์ž‡๊ณ  Set Speed์™€ ์ด์–ด์ฃผ์ž.

์ด์ œ ์šฐ๋ฆฌ๋Š” isJump๋ณ€์ˆ˜๋ฅผ ํ†ตํ•ด์„œ ์บ๋ฆญํ„ฐ๊ฐ€ ๊ณต์ค‘์ธ์ง€ ์•„๋‹Œ์ง€๋ฅผ ์•Œ ์ˆ˜ ์žˆ๋‹ค.

Idle > Jump & Run > Jump

Idle > Jump, Run > Jump ์ƒํƒœ๋ฅผ ์ด์–ด์ฃผ์ž.

๊ฐ ์ƒํƒœ์ผ ๋•Œ isJump๊ฐ€ True์ด๋ฉด Jump ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์‹คํ–‰ํ•˜๋ฉด ๋œ๋‹ค.

๊ทธ๋Ÿฌ๋‹ˆ Get isJump๋ฅผ ๊ฐ€์ ธ์™€์„œ ๋ฐ”๋กœ ์—ฐ๊ฒฐํ•ด์ฃผ์ž

Idle > Jump, Run > Jump ๋‘˜ ๋‹ค ๋˜‘๊ฐ™์ด ๋งŒ๋“ค๋ฉด ๋œ๋‹ค!

โ—์ปดํŒŒ์ผ ์ €์žฅโ—์„ ํ•ด์ฃผ๊ณ  ํ”Œ๋ ˆ์ดํ•ด๋ณด์ž.
์ ํ”„ํ•˜๋ฉด ์• ๋‹ˆ๋ฉ”์ด์…˜์ด ๋‚˜์˜ค๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค!

์ด์ œ ํƒˆ์ถœ์กฐ๊ฑด์„ ๋งŒ๋“ค์–ด์ฃผ์ž.

Jump > Idle

ํƒˆ์ถœ ์กฐ๊ฑด์€ ๊ฐ„๋‹จํ•˜๋‹ค.
isJump๊ฐ€ False๊ณ  Speed๊ฐ€ 0์ด๋ฉด ๋œ๋‹ค.

Jump > Idle์„ ์ด์–ด์ฃผ์—ˆ๋‹ค.

  1. isJump == False
  2. Speed == 0

์œ„ ์กฐ๊ฑด์— ๋งž๊ฒŒ ๋…ธ๋“œ๋ฅผ ๋งŒ๋“ค์ž.

์™„์„ฑ์ด๋‹ค.
โ—์ปดํŒŒ์ผ ์ €์žฅโ—์„ ํ•ด์ฃผ๊ณ  ํ”Œ๋ ˆ์ดํ•ด๋ณด์ž.
Space๋งŒ ๋ˆ„๋ฅด๋ฉด ๋‹ค์‹œ Idle๋กœ ์˜ค๊ณ  ์›€์ง์ธ๋‹ค๋ฉด ์ ํ”„ ๋ชจ์…˜์—์„œ ํƒˆ์ถœํ•˜์ง€ ๋ชปํ•˜๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

Jump > Run

๋ฐ˜๋Œ€๋กœ isJump๊ฐ€ False๊ณ  Speed๊ฐ€ 0 ์ด์ƒ์ด๋ฉด ๋œ๋‹ค.

Jump > Run์„ ์ด์–ด์ฃผ์—ˆ๋‹ค.

  1. isJump == False
  2. Speed > 0

์œ„ ์กฐ๊ฑด์— ๋งž๊ฒŒ ๋…ธ๋“œ๋ฅผ ๋งŒ๋“ค์ž.

Equal๋…ธ๋“œ๋ฅผ Greater๋กœ๋งŒ ๋ณ€๊ฒฝํ•ด์ฃผ์—ˆ๋‹ค.

โ—์ปดํŒŒ์ผ ์ €์žฅโ—์„ ํ•ด์ฃผ๊ณ  ํ”Œ๋ ˆ์ดํ•ด๋ณด์ž.

์–ด๋–ค ์ƒํƒœ์—์„œ๋„ ๋‹ค์‹œ ์บ๋ฆญํ„ฐ์˜ ์• ๋‹ˆ๋ฉ”์ด์…˜์ด ํšŒ๋ณต๋˜๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.


๋งˆ๋ฌด๋ฆฌ

์—ฌ๊ธฐ๊นŒ์ง€ Jump ์• ๋‹ˆ๋ฉ”์ด์…˜ ์ƒํƒœ ์ „ํ™˜์„ ๊ตฌํ˜„ํ•˜์˜€๋‹ค.
๋‹ค์Œ์—๋Š” ๋‹จ์กฐ๋กœ์šด ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์ข€ ๋” ์—ญ๋™์ ์œผ๋กœ ํ‘œํ˜„๋˜๋„๋ก ๊ฐœ์„ ํ•ด๋ณด๊ฒ ๋‹ค.

1. ์• ๋‹ˆ๋ฉ”์ด์…˜ ๋ธ”๋ฃจํ”„๋ฆฐํŠธ ์ƒ์„ฑ
2. State Machine ์ถ”๊ฐ€
3. ์ •์ง€
4. ๋‹ฌ๋ฆฌ๊ธฐ
5. ์ ํ”„
6. ๊ฐœ์„ 

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

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