Class GameDev* SheepAdult

[Unreal Engine] Set Scale of SplineMeshComponent 본문

Unreal Engine

[Unreal Engine] Set Scale of SplineMeshComponent

SheepAdult 2025. 1. 28. 03:26

SplineMeshComponent의 크기를 직접적으로 설정하게 되면 StaticMesh가 의도한 위치에 생성되지 않는다. SetStartScale과 SetEndScale을 각각 설정해 줘야 의도한 대로 생성된다.

잘못된 예)

USplineMeshComponent* SplineMeshComp = NewObject<USplineMeshComponent>(OwnerCharacter, USplineMeshComponent::StaticClass());
SplineMeshComp->SetWorldScale3D(FVector(3));
SplineMeshComp->RegisterComponent();

 

옳은 예)

USplineMeshComponent* SplineMeshComp = NewObject<USplineMeshComponent>(OwnerCharacter, USplineMeshComponent::StaticClass());
SplineMeshComp->SetStartScale(FVector2D(0.2f));
SplineMeshComp->SetEndScale(FVector2D(0.2f));
SplineMeshComp->RegisterComponent();