Notice
Recent Posts
Recent Comments
Link
«   2025/08   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
Archives
Today
Total
관리 메뉴

For me

[Unreal Engine] 4) C++ / 블루프린터 - 2 본문

Unreal Engine/이론

[Unreal Engine] 4) C++ / 블루프린터 - 2

GiveZero 2023. 1. 24. 13:43

단순히 공이 뛰어오르는 것을 구현해보자.

 

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가 된다.