For me
[Unreal Engine] 4) C++ / 블루프린터 - 2 본문
단순히 공이 뛰어오르는 것을 구현해보자.
C++ 클래스에 함수 선언
UFUNCTION(BlueprintCallable, Category="Move")
void InputKey(bool pressed);
UFUNCTION(BlueprintCallable, Category = "Move")
void Move(float DeltaTime)
void AMyActor::InputKey(bool Pressed)
{
bPressedKey = Pressed;
}
void AMyActor::Move(float DeltaTime)
{
if (bPressedKey)
{
FVector Location = GetActorLocation();
Location += FVector::UpVector * 980.0f * DeltaTime;
SetActorLocation(Location);
}
}
블루프린트 에서 함수 호출
https://docs.unrealengine.com/4.26/en-US/InteractiveExperiences/Input/ActorInput/
Setting Up Input on an Actor
A How To Guide to Setting up Input for an Actor in Unreal Engine 4.
docs.unrealengine.com
위의 문서에서 확인
다음과 같이 EvenetTick에 Move함수를 호출해 준것과 같다.
SpaceBar키를 누르면 bPressed가 True, 때면 false가 된다.
'Unreal Engine > 이론' 카테고리의 다른 글
[Unreal Engine] 6) Nanite (0) | 2023.01.24 |
---|---|
[Unreal Engine] 5) Input (0) | 2023.01.24 |
[Unreal Engine] 3) C++ / 블루프린터 - 1 (0) | 2023.01.24 |
[Unreal Engine] 2) 큐브 그리드 / 퀵셀 (0) | 2023.01.23 |
[Unreal Engine] 1) 화면 구성 / Viewport 조작 (0) | 2023.01.23 |