본문 바로가기
[ CODING STUDY ]/》언리얼엔진5 실습

언리얼엔진5 c++ SpawnEmitterAtLocation

by MRG 2024. 4. 26.
728x90
반응형

 

▣ 먼저 파티클시스템을 저장할 변수를 선언합니다. 

 

 

▣ 그리고 cpp파일에서 #include "Kismet/GameplayStatics.h"와 #include "Particles/ParticleSystem.h" 헤더를 추가합니다. 

 

▣ "Kismet/GameplayStatics.h"   : 블루프린트와 C++ 모두에서 호출할 수 있는 유용한 게임플레이 유틸리티 함수가 포함된 정적 클래스

 

▣ #include "Particles/ParticleSystem.h"  : ParticleSystem은 원하는 수의 ParticleEmitters를 포함하는 클래스

 

https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Engine/Kismet/UGameplayStatics?application_version=5.3

 

UGameplayStatics

Static class with useful gameplay utility functions that can be called from both Blueprint and C++

dev.epicgames.com

 

https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Engine/Particles/UParticleSystem?application_version=5.3

 

UParticleSystem

A ParticleSystem is a complete particle effect that contains any number of ParticleEmitters.

dev.epicgames.com

 

 

▣ 오브젝트를 찾아서 변수에 넣는 코드를 완성합니다.

경로지정 시 파이클효과를 찾을 때에 경로에 ParticleSystem을 앞에 넣어줘야 오류가 나오지 않습니다. 

 

 

▣ 그리고 총을 쏘는 함수 안에 UGameplayStatics를 접근하여 SpawnEmitterAtLocation() 함수를 호출하는 코드를 완성합니다. 

 

▣ SpawnEmitterAtLocation() : 주어진 위치와 회전에서 지정된 효과를 재생하는 함수

 

https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Engine/Kismet/UGameplayStatics/SpawnEmitterAtLocation/1?application_version=5.3

 

UGameplayStatics::SpawnEmitterAtLocation

Plays the specified effect at the given location and rotation, fire and forget.

dev.epicgames.com

 

 

▣ 블루프린트에 이 노드와 동일하다고 생각하시고 매개변수를 추가하시면 됩니다. 

 

 

▣ 컴파일 후 변수에 파티클효과가 잘 들어갔는지 확인하고

 

 

▣ 플레이를 해서 효과가 잘 나오는지 확인합니다. 

728x90
반응형

댓글