1. 만들어 놓은Blendspace를 끌어다 놓고, OutputPose - Result에 링크

 

compile하면 blendspace노드에 그리드 형태가 나온다.

 

2. Angle,Speed변수를 생성하여 값 셋팅

3. 사용하려는 캐릭터 블루프린트의 AnimationMode : UseAnimationBlueprint로 변경

AnimClass : 적용하려는 ABP로 변경

 

4. EventBluePrint함수에서 pawn정보(각도,이동속도)를 가져와서 애니메이션을 동작하도록 할 수 있다.

TryGetPawnOwner : 현재 pawn owner

GetVelocity : speed값을 셋팅하기 위한

VectorLength : 벡터의 속도 값만 필요(float)

 

'언리얼' 카테고리의 다른 글

unreal) blend space  (0) 2025.01.01
unreal) Animaion Blueprint Blend  (0) 2024.12.31
unreal) camera lag  (0) 2024.12.23
unreal) TSubclassOf<class ~>  (0) 2024.12.20
unreal) CameraShake, ClientStartCameraShake  (0) 2024.12.19

블렌드 스페이스(Blend Space)는 언리얼 엔진에서 여러 입력값에 따라 몇 개의 애니메이션을 블렌딩할 수 있게 만들어주는 에셋

 

애니메이션 중간 보간된 상태를 적절하게 보여준다.

 

preview valu값은 컨트롤 키를 눌러야 움직일 수 있음

 

'언리얼' 카테고리의 다른 글

unreal) Blendspace : AnimGraph 에서 사용하기  (0) 2025.01.01
unreal) Animaion Blueprint Blend  (0) 2024.12.31
unreal) camera lag  (0) 2024.12.23
unreal) TSubclassOf<class ~>  (0) 2024.12.20
unreal) CameraShake, ClientStartCameraShake  (0) 2024.12.19

애니메이션 블루프린트 

언리얼의 블루프린트 애니메이션 블랜드를 통해 앞으로 뛰는 애니메이션과 가만히 서있는 애니메이션을 특정 변수의 값에 따라 동작하도록 설정할 수 있다.

 

Forward 값을 통해 0~1로 적절하게 Blend 조절

 

Left 값을 통해 적절하게 섞을 수 있다.

'언리얼' 카테고리의 다른 글

unreal) Blendspace : AnimGraph 에서 사용하기  (0) 2025.01.01
unreal) blend space  (0) 2025.01.01
unreal) camera lag  (0) 2024.12.23
unreal) TSubclassOf<class ~>  (0) 2024.12.20
unreal) CameraShake, ClientStartCameraShake  (0) 2024.12.19

 

 

'언리얼' 카테고리의 다른 글

unreal) blend space  (0) 2025.01.01
unreal) Animaion Blueprint Blend  (0) 2024.12.31
unreal) TSubclassOf<class ~>  (0) 2024.12.20
unreal) CameraShake, ClientStartCameraShake  (0) 2024.12.19
unreal) BlueprintImplementableEvent  (0) 2024.12.09

Ocsillation Duration : 카메라 쉐이크 경과 시간

Ocsillation Blend in/out Time,  : 시작과 끝의 블렌드 지속 시간

Rot Ocsillation : 회전 진동 :진동 기능에 따라 카메라가 회전

Loc Ocsillation : 위치 진동 : 카메라를 이리저리 움직임

FOV Ocsillation  : 카메라를 확대, 축소하면서 시야에 영향을 줌

 

GetWorld()->GetFirstPlayerController()->ClientStartCameraShake(DeathCameraShakeClass);

포탄 쏠때

 

터렛 죽을때

'언리얼' 카테고리의 다른 글

unreal) camera lag  (0) 2024.12.23
unreal) TSubclassOf<class ~>  (0) 2024.12.20
unreal) BlueprintImplementableEvent  (0) 2024.12.09
unreal) GetWorldTimerManager()  (0) 2024.11.28
unreal) 특정 거리 안에 들어오면 회전하는 타워  (0) 2024.11.28

BlueprintImplementableEvent

정의만 하고 구현은 블루프린트에서만 할 수 있도록

 

 

타이머 등록

 
GetWorldTimerManager().SetTimer(FireRateTimerHandle, this, &ATower::CheckFireCondition, FireRate, true);

 

내부

FORCEINLINE void SetTimer(FTimerHandle& InOutHandle, UserClass* InObj, typename FTimerDelegate::TMethodPtr< UserClass > InTimerMethod, float InRate, bool InbLoop = false, float InFirstDelay = -1.f)
{
    InternalSetTimer(InOutHandle, FTimerUnifiedDelegate( FTimerDelegate::CreateUObject(InObj, InTimerMethod) ), InRate, InbLoop, InFirstDelay);
}

InOutHandle : 타이머를 관리하는 핸들러

InTimerMethod : 타이머 종료시 실행 함수

InRate : 반복되는 주기

InbLoop : 반복 여부

 

 

타이머 해제

GetWorldTimerManager().ClearTimer(FireRateTimerHandle);

Tower.cpp

void ATower::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

	if(Tank)
	{
		float Distance = FVector::Dist(GetActorLocation(), Tank->GetActorLocation());
		if (Distance <= FireRange)
		{
			RotateTurret(Tank->GetActorLocation());
		}
	}
}

void ATower::BeginPlay()
{
	Super::BeginPlay();

	Tank = Cast<ATank>(UGameplayStatics::GetPlayerPawn(this, 0));
}

 

 

BeginPlay에서 현재 PlayerPawn을 가져온다. (Tank)  매번 호출하기에는 부하가 있으니

Tank = Cast<ATank>(UGameplayStatics::GetPlayerPawn(this, 0));

 

그 이후 Tick()에서 특정 거리 안에 들어오면 Rotate처리

float Distance = FVector::Dist(GetActorLocation(), Tank->GetActorLocation());

FVector::Dist를 통해 Tank와 거리 계산

 

'언리얼' 카테고리의 다른 글

unreal) BlueprintImplementableEvent  (0) 2024.12.09
unreal) GetWorldTimerManager()  (0) 2024.11.28
unreal) FMath::RInterpTo  (0) 2024.11.20
unreal) DrawDebugSphere  (0) 2024.11.19
unreal) EditDefaultsOnly, EditInstanceOnly, BlueprintReadWrite  (0) 2024.11.11

매개변수

  • Center: The center location of the sphere in the game world.
  • Radius: The radius of the sphere.
  • Segments: The number of segments used to approximate the sphere’s surface.
  • Color: The color of the sphere.
  • PersistentLines: Whether the sphere’s lines should persist between frames.
  • LifeTime: The amount of time the sphere should remain visible, in seconds.
  • DepthPriority: The priority of the sphere’s depth in the rendering pipeline.
  • Thickness: The thickness of the lines used to draw the sphere.

 

	DrawDebugSphere(GetWorld(), GetActorLocation() + FVector(0, 0, 200),
		100.f,12, FColor::Red, true,30.f);

 

 

 

GetHitResultUnderCursor

Trace Hit

void ATank::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

	if(PlayerControllerRef)
	{
		FHitResult HitResult;
		PlayerControllerRef->GetHitResultUnderCursor(ECC_Visibility, false, HitResult);
		DrawDebugSphere(GetWorld(), HitResult.ImpactPoint,
	25.f,12, FColor::Red, false,-1.f);
	
	}
}

 

 

 

참고
https://agrawalsuneet.github.io/blogs/drawdebugsphere-in-unreal/

EditDefaultsOnly

default 편집에서만 수정가능

 

EditInstanceOnly

인스턴스에서만 편집가능

 

BlueprintReadWrite

블루프린트에서 접근 가능

 

AllowPrivateAccess = "true"

BlueprintReadWrite 키워드를 썼기 때문에 접근제한자 private에서도 사용 불가능하지만.

AllowPrivateAccess  = "true"로 사용 가능하도록 할 수 있다.

 

 

Category = "Super Duper ~~"

설정한 카테고리 이름으로 블루프린트에서 검색이 가능하다.

단순히 솔루션 탐색기에서  delete를 해도 완전히 삭제되지 않는다.

1. 언리얼 에디터 종료

2. 솔루션탐색기 에서 제거

3. 프로젝트 폴더에에서 클래스 삭제

4.솔루션 재빌드

 

VisibleAnywhere

블루프린트에서 보이지만 수정 불가능

 

EditAnywhere

블루프린트에서 수정가능한 필드

 

VisibleInstanceOnly

블루프린트에 detail창에는 보이지 않지만 Main 배치한 인스턴스에서만 보인다.

GetOverlappingActors : 액터가져오기

AActor* UTriggerComponent::GetAcceptableActor() const
{
	TArray<AActor*> Actors;
	GetOverlappingActors(Actors);

	for (AActor* Actor : Actors)
	{
		bool HasAcceptableTag = Actor->ActorHasTag(AcceptableActorTag);
		bool IsGarbbed = Actor->ActorHasTag("Grabbed");
		if (HasAcceptableTag && !IsGarbbed)
		{
			return Actor;
		}
	}

	return nullptr;
}

 

셋팅해놓은 태그가 붙어있고 Grabbed가아니면 액터를 반환.

UPrimitiveComponent : "기본적인 렌더링 기능 컴포넌트 클래스"

void UGrabber::Grab()
{
	UE_LOG(LogTemp, Display, TEXT("Grab"));

	UPhysicsHandleComponent* PhysicsHandle = GetPhysicsHandle();
	if (PhysicsHandle == nullptr)
	{
		return;
	}

	FHitResult HitResult;
	if (GetGrabberableInReach(HitResult))
	{
		UPrimitiveComponent* HitComponent = HitResult.GetComponent();
		HitComponent->SetSimulatePhysics(true);
		HitComponent->WakeAllRigidBodies();
		AActor* HitActor = HitResult.GetActor();
		HitActor->Tags.Add("Grabbed");
		HitActor->DetachFromActor(FDetachmentTransformRules::KeepWorldTransform);
		PhysicsHandle->GrabComponentAtLocationWithRotation(
			HitResult.GetComponent(),
			NAME_None,
			HitResult.ImpactPoint,
			GetComponentRotation()
		);
	}
}

HitActor->Tags.Add("Grabbed"); : 동적으로 Tag추가

HitActor->DetachFromActor(FDetachmentTransformRules::KeepWorldTransform); : Actor의 RootComponent를 현재 연결되어 있는 모든 SceneComponent에서 분리

 

석상이 놓여있으면 트리거로 인해 철장이 열리고 잡는 순간 다시 철장이 내려옴

 

 

같은 속성의 액터오브젝트로 바꿔치기

가고일 석상으로 인해 문이 내려가다가 멈춘다.

이 가고일에 컴포넌트에 접근하여서 물리적용 해제 하기

 

 

if (Actor != nullptr)
{
	UPrimitiveComponent* Component = Cast<UPrimitiveComponent>(Actor->GetRootComponent());
	if (Component != nullptr)
	{
		Component->SetSimulatePhysics(false);
	}
    
	Actor->AttachToComponent(this, FAttachmentTransformRules::KeepWorldTransform);
	Mover->SetShouldMove(true);
}

 

- UPrimitiveComponent`는 Unreal Engine에서 사용되는 주요 컴포넌트 중 하나로, 모든 "기본적인" 렌더링 가능 컴포넌트의 기본 클래스

 - SetSimulatePhysics(bool) 물리 시뮬레이션 on/off

- AttachToComponent : RootComponent를 제공된 구성 요소에 연결

wall하위로 들어갔다.

 

결과

문이 밑으로 내려간다.

 

문제

변수에 데이터를 추가 후 라이브 코딩을 통해 업데이트 과정을 거친 후 에디어틀 재시작하면 변수가 사라지는 이슈가 있다.

ex) MyInt3이라는 변수에 '500'을 셋팅

 

에디터 재시작

MyInt3가 사라짐

언리얼 에디터에서 라이브코딩을 하면 MyInt3변수는 복구되나 셋팅한 값이 사라짐.

 

 

해결방법

에디터를 닫고 빌드 후 다시 에디터 실행

 

 

 

Solution Explorer에서 Build로 처리

 

 

AutoPossessPlayer 설정을 Player0으로 셋팅

AutoPossessPlayer : 레벨이 시작될 때나 폰이 생성될 때, 자동으로 폰을 소유해야하는 플레이어 컨트롤러를 결정

 

 

 

갑자기 블루프린트 창에 아무것도 안뜨는 경우가 있었다. 당황스러운...

 

해결방법 : window -> class default -> 블루프린트 에디터열기!

+,-,*,/ 연산자 추가하기

PIN CONVERSIONS로  타입선택

Add pin으로 더하기 피연산자 추가

Add한거 출력해보기

VARIABLES -> '+'버튼으로 추가

Name : 언리얼 내부에서 사용하는 변수, 빠른 검색에 용이, 용량도 적다

Text : 다국어 변환할때 용이

Tools -> Localization DashBoard

 

Print Text

=>

Event BeginPlay : 게임이 시작하고 한번 실행

EventTick : 매 프레임 실행

 

주석기능 : 드래그하고 'C'

연결된 라인 정리 : 가운데 더블클릭, ctrl누르고 이동

 

정리 : 단축키 q

+ Recent posts