이 문서는 색이 변하고 접촉 시 천천히 흐려지는 라이트 액터를 설정하는 방법을 설명합니다.
이는 오버랩 트리거로 작동하는 박스 컴포넌트와 포인트 라이트 액터를 조작하는 타임라인 컴포넌트를 포함한 포인트 라이트 컴포넌트를 통해 이뤄집니다.

페이딩 라이트 액터 만들기
-
빈 템플릿(Blank) 기반의 새로운 블루프린트(Blueprint) 프로젝트를 만들고 FadingLights 라고 명명합니다.
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
-
콘텐츠 브라우저(Content Browser) 로 이동한 후 추가 (+)(Add (+)) 버튼을 눌러 BP_LightActor 라는 이름의 새 블루프린트 액터(Actor) 클래스를 생성합니다.
-
콘텐츠 브라우저 에서 BP_LightActor 를 더블 클릭 해서 블루프린트 에디터(Blueprint Editor) 를 연 다음 클래스 디폴트(Class Defaults) 를 엽니다.
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
-
컴포넌트(Component) 탭으로 이동하여 추가 (+)(Add (+)) 버튼을 클릭한 뒤 드롭다운 메뉴에서 박스 콜리전(Box Collision) 을 선택하고 이름을 OverlapCollision 으로 변경합니다.
-
컴포넌트(Components) 탭에서 OverlapCollision 을 선택하고 DefaultSceneRoot 로 드래그해 OverlapCollision 을 새로운 루트 컴포넌트로 만듭니다.
-
컴포넌트(Component) 탭에서 추가 (+)(Add (+)) 를 클릭하고 포인트 라이트(Point Light) 를 검색해 선택합니다.
-
이벤트 그래프(Event Graph) 를 열고 그래프를 우클릭한 다음 블루프린트 컨텍스트 메뉴(Blueprint Context Menu) 에서 타임라인 추가(Add Timeline) 를 검색해 선택합니다. 타임라인을 PointLightTimeline 으로 명명합니다.
-
내 블루프린트(My Blueprint) 탭으로 이동한 후 변수(Variables) 카테고리에서 (+) 버튼을 클릭해 플로트(float) 유형의 새 변수를 추가합니다. 추가한 변수를 BrightnessMultiplier 라고 명명하고 블루프린트를 컴파일합니다. 디테일(Details) 패널에서 기본값(Default Value) 을 20.0 으로 설정합니다.
-
컴파일(Compile) 과 저장(Save) 버튼을 클릭합니다.
밝기 트랙 설정하기
플레이어가 라이트 액터의 박스 컴포넌트 바운드에 오버랩되는 경우, 타임라인 컴포넌트에는 포인트 라이트 컴포넌트의 밝기 값을 조작할 플로트 커브가 필요합니다.
밝기의 초기 값은 5000 이며, 5초 에 걸쳐 0 으로 감소합니다.
-
PointLightTimeline 노드를 더블 클릭해 타임라인 에디터(Timeline Editor) 를 열고 트랙(Track) > Float 트랙 추가(Add Float Track) 를 클릭합니다.
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
-
플로트 커브 트랙의 이름을 LightBrightnessFloatTrack 으로 설정하고 *Shift 를 누른 상태로 그래프를 클릭하여 트랙에 키를 2개 추가합니다. 첫 번째 키를 클릭하고 시간 값을 (0, 5000) 으로 설정한 후, 두 번째 키를 클릭하고 시간 값을 (5, 0)** 으로 설정합니다.
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
-
완성된 LightBrightnessFloat 트랙은 아래와 같습니다.
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
컬러 트랙 설정하기
플레이어가 라이트 액터의 박스 컴포넌트 바운드에 오버랩되는 경우, 포인트 라이트 타임라인에는 포인트 라이트 컴포넌트의 컬러 프로퍼티를 조작할 선형 컬러 커브 트랙이 필요합니다.
-
타임라인 에디터 에서 컬러 커브 트랙을 추가합니다.
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
-
새 컬러 트랙을 LightLinearColorTrack 으로 명명합니다.
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
-
첫 번째 컬러 키를 더블클릭해 시간 값을 0 으로, RGB 값을 ( R: 1, G: 0.665, B: 0.015)로 변경합니다.
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
-
두 번째 컬러 키를 더블 클릭해 시간 값을 5 로, RGB 값을 ( R: 0, G: 0, B: 0)으로 변경합니다.
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
-
컴파일(Compile) 과 저장(Save) 버튼을 클릭합니다.
-
완성된 컬러 트랙은 아래와 같습니다.
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
작업 중인 블루프린트
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
콜리전 오버랩 이벤트 및 업데이트 로직 생성하기
박스 컴포넌트에는 액터가 콜리전 바운드에 들어갈 때 타임라인 컴포넌트를 트리거하는 기능이 필요합니다.
또한 포인트 라이트 타임라인에는 밝기와 컬러를 변경하기 위한 업데이트가 필요합니다.
-
블루프린트 에디터(Blueprint Editor) 의 컴포넌트(Components) 탭으로 이동한 후 OverlapCollision 박스 컴포넌트를 선택합니다. 디테일(Details) 패널에서 이벤트(Events) 카테고리로 스크롤을 내려 컴포넌트 오버랩 시작 시(On Component Begin Overlap) 이벤트 옆에 있는 + 아이콘을 클릭합니다.
-
On Component Begin Overlap (OverlapCollision) 노드의 실행 핀을 드래그하여 PointTimelineComponent 노드의 Play 핀에 연결합니다.
Begin Object Class=/Script/BlueprintGraph.K2Node_Timeline Name="K2Node_Timeline_0" TimelineName="PointLightTimeline" TimelineGuid=9B6871DF41CC70785FBD70A935625EAC NodePosX=448 NodePosY=80 bCanRenameNode=True ErrorType=1 NodeGuid=CD70BA9E43E1F7EB1FF420816FF55084 CustomProperties Pin (PinId=E50CDF574B8B5BE1ECFB4AB4CE506DCD,PinName="Play",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_ComponentBoundEvent_0 3608BECC49E96377DB2960B5B1108C19,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=7B459F68414F7C0977CD2191A446853E,PinName="PlayFromStart",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=3B492C5145FAF24CAB2B7AAEEA07A923,PinName="Stop",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=BE2C31AB4E0D68E68EA684B10CB8BED5,PinName="Reverse",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=BD1E6E7E48EE7A9DBF6E6D82849920FF,PinName="ReverseFromEnd",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=B34A88804DC700EB96C1A08A8BC63B0E,PinName="Update",Direction="EGPD_Output",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_CallFunction_2 9C312EB049C5A1020D6797A147DEABB8,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=8D513CA546C97BEAC7B6A4AF44A12299,PinName="Finished",Direction="EGPD_Output",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=E6EE52734B58BA4623436EA5FE8BB8BC,PinName="SetNewTime",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=87A9CA2245DA3C1405FEE58EC3344746,PinName="NewTime",PinType.PinCategory="real",PinType.PinSubCategory="float",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="0.0",AutogeneratedDefaultValue="0.0",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=CA29340A4DA024A1403EF6BDDAF84042,PinName="Direction",Direction="EGPD_Output",PinType.PinCategory="byte",PinType.PinSubCategory="",PinType.PinSubCategoryObject=Enum'"/Script/Engine.ETimelineDirection"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=5D3D277B4502D9621FEE289C0C2C69A1,PinName=" LightBrightnessFloatTrack",Direction="EGPD_Output",PinType.PinCategory="real",PinType.PinSubCategory="float",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_PromotableOperator_0 82EF0A4B4E496697FA249BB6F7507FDF,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=E21609824D5C866D9DB781A807FE09D0,PinName="LightLinearColorTrack",Direction="EGPD_Output",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=ScriptStruct'"/Script/CoreUObject.LinearColor"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_Knot_6 D90419F74048C11128F75A94675B08E1,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) End Object Begin Object Class=/Script/BlueprintGraph.K2Node_ComponentBoundEvent Name="K2Node_ComponentBoundEvent_0" DelegatePropertyName="OnComponentBeginOverlap" DelegateOwnerClass=Class'"/Script/Engine.PrimitiveComponent"' ComponentPropertyName="OverlapCollision" DelegatePropertyDisplayName=NSLOCTEXT("UObjectDisplayNames", "PrimitiveComponent:OnComponentBeginOverlap", "On Component Begin Overlap") EventReference=(MemberParent=Package'"/Script/Engine"',MemberName="ComponentBeginOverlapSignature__DelegateSignature") bInternalEvent=True CustomFunctionName="BndEvt__BP_LightActor_OverlapCollision_K2Node_ComponentBoundEvent_0_ComponentBeginOverlapSignature__DelegateSignature" NodePosX=48 NodePosY=80 NodeGuid=BBCDCF4E488AC70C2C1425807166E35D CustomProperties Pin (PinId=1759D9404D426D8180DC08AED4CC47BD,PinName="OutputDelegate",Direction="EGPD_Output",PinType.PinCategory="delegate",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(MemberParent=BlueprintGeneratedClass'"/Game/Blueprints/BP_LightActor.BP_LightActor_C"',MemberName="BndEvt__BP_LightActor_OverlapCollision_K2Node_ComponentBoundEvent_0_ComponentBeginOverlapSignature__DelegateSignature"),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=3608BECC49E96377DB2960B5B1108C19,PinName="then",Direction="EGPD_Output",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_Timeline_0 E50CDF574B8B5BE1ECFB4AB4CE506DCD,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=E89620D04B90AC9AE8C0E791F2FF1B39,PinName="OverlappedComponent",PinToolTip="오버랩된 컴포넌트\n프리미티브 컴포넌트 오브젝트 레퍼런스",Direction="EGPD_Output",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=Class'"/Script/Engine.PrimitiveComponent"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=1778E5CB43BF80FE3F648D940DF0C142,PinName="OtherActor",PinToolTip="기타 액터\n액터 오브젝트 레퍼런스",Direction="EGPD_Output",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=Class'"/Script/Engine.Actor"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=6F3818FC4E9B3EB37CB1A7BD037EBFB7,PinName="OtherComp",PinToolTip="기타 컴포넌트\n프리미티브 컴포넌트 오브젝트 레퍼런스",Direction="EGPD_Output",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=Class'"/Script/Engine.PrimitiveComponent"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=4C32537F4195796C764B9AB4A1D531EE,PinName="OtherBodyIndex",PinToolTip="기타 바디 인덱스\n인티저",Direction="EGPD_Output",PinType.PinCategory="int",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="0",AutogeneratedDefaultValue="0",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=CCD65B384CBC4EFEC93021905B1DFAFF,PinName="bFromSweep",PinToolTip="휩쓸기(Sweep)\n부울",Direction="EGPD_Output",PinType.PinCategory="bool",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="false",AutogeneratedDefaultValue="false",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=69378B444803AF25C64D9F8D54850B9B,PinName="SweepResult",PinToolTip="휩쓸기(Sweep) 결과\n히트 결과 구조체(레퍼런스)",Direction="EGPD_Output",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=ScriptStruct'"/Script/Engine.HitResult"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=True,PinType.bIsConst=True,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) End Object -
컴포넌트(Components) 탭에서 PointLight 컴포넌트를 이벤트 그래프(Event Graph) 로 드래그합니다.
Begin Object Class=/Script/BlueprintGraph.K2Node_VariableGet Name="K2Node_VariableGet_0" VariableReference=(MemberName="PointLight",bSelfContext=True) NodePosX=848 NodePosY=144 NodeGuid=5EB41437410885083479FEB985CC498E CustomProperties Pin (PinId=BE0F44F644A651B59B7B768F23043181,PinName="PointLight",Direction="EGPD_Output",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=Class'"/Script/Engine.PointLightComponent"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_CallFunction_2 B0B1479D4AF0E3B08F76A09E55059CE2,K2Node_Knot_0 F1E8A86F4F35354E9427F38B9E297E03,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=EF8864E146E66B02527255B9E06B6025,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "Target", "Target"),PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=BlueprintGeneratedClass'"/Game/Blueprints/BP_LightActor.BP_LightActor_C"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=True,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) End Object -
PointLight 의 핀에서 드래그한 후 액션 메뉴에서 Set Intensity 노드를 찾아 추가합니다.
Begin Object Class=/Script/BlueprintGraph.K2Node_CallFunction Name="K2Node_CallFunction_2" FunctionReference=(MemberParent=Class'"/Script/Engine.LightComponent"',MemberName="SetIntensity") NodePosX=1040 NodePosY=64 NodeGuid=23E0F4404C18096DF62804AFAA7BC709 CustomProperties Pin (PinId=9C312EB049C5A1020D6797A147DEABB8,PinName="execute",PinToolTip="\nExec",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_Timeline_0 B34A88804DC700EB96C1A08A8BC63B0E,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=87A5CA2F43E3E67419AFD1A8953F299B,PinName="then",PinToolTip="\n실행",Direction="EGPD_Output",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_CallFunction_3 744D0148419A07627F1A9F978A0C575D,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=B0B1479D4AF0E3B08F76A09E55059CE2,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "Target", "Target"),PinToolTip="타깃\n라이트 컴포넌트 오브젝트 레퍼런스",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=Class'"/Script/Engine.LightComponent"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_VariableGet_0 BE0F44F644A651B59B7B768F23043181,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=FDEA2486488BDE31C3E56B9DDFB9CD27,PinName="NewIntensity",PinToolTip="새 강도 설정\n플로트(싱글 정밀도)",PinType.PinCategory="real",PinType.PinSubCategory="float",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="0.0",AutogeneratedDefaultValue="0.0",LinkedTo=(K2Node_PromotableOperator_0 69A2EF8C4A59A02C101F58AD8511E67A,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) End Object -
PointLightTimeline 노드에서Light Brightness Float Track 핀을 드래그한 후 액션 메뉴에서 Multiply 노드를 찾아 추가합니다.
Begin Object Class=/Script/BlueprintGraph.K2Node_PromotableOperator Name="K2Node_PromotableOperator_0" bIsPureFunc=True FunctionReference=(MemberParent=Class'"/Script/Engine.KismetMathLibrary"',MemberName="Multiply_DoubleDouble") NodePosX=864 NodePosY=192 NodeGuid=64A7E68440746F350AC19F86346C4452 CustomProperties Pin (PinId=82EF0A4B4E496697FA249BB6F7507FDF,PinName="A",PinToolTip="A\n플로트(더블 정밀도)",PinType.PinCategory="real",PinType.PinSubCategory="double",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_Timeline_0 5D3D277B4502D9621FEE289C0C2C69A1,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=75D0A21342595E689923BA87FB4EF370,PinName="B",PinToolTip="B\n플로트(더블 정밀도)",PinType.PinCategory="real",PinType.PinSubCategory="double",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_VariableGet_1 485EF0D44BC98AA6894EF282D5F53F5F,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=69A2EF8C4A59A02C101F58AD8511E67A,PinName="ReturnValue",PinToolTip="반환 값\n플로트(더블 정밀도)\n\n곱셈(A * B)",Direction="EGPD_Output",PinType.PinCategory="real",PinType.PinSubCategory="double",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_CallFunction_2 FDEA2486488BDE31C3E56B9DDFB9CD27,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) End Object -
내 블루프린트(My Blueprint) 탭에서 BrightnessMultiplier 플로트 변수를 이벤트 그래프(Event Graph) 로 드래그하여 Get Brightness Multiplier 를 선택한 후 Multiply 노드에 연결합니다.
Begin Object Class=/Script/BlueprintGraph.K2Node_VariableGet Name="K2Node_VariableGet_1" VariableReference=(MemberName="BrightnessMultiplier",MemberGuid=FCCF7F5E4A6E4FD75FAA849998FE2E92,bSelfContext=True) NodePosX=864 NodePosY=288 NodeGuid=3B08B13441FCF1AEDC7E3CA58137A9D2 CustomProperties Pin (PinId=485EF0D44BC98AA6894EF282D5F53F5F,PinName="BrightnessMultiplier",Direction="EGPD_Output",PinType.PinCategory="real",PinType.PinSubCategory="double",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="0.0",AutogeneratedDefaultValue="0.0",LinkedTo=(K2Node_PromotableOperator_0 75D0A21342595E689923BA87FB4EF370,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=8978695144D2F58451CFF4858B5A8790,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "Target", "Target"),PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=BlueprintGeneratedClass'"/Game/Blueprints/BP_LightActor.BP_LightActor_C"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=True,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) End Object -
PointLightTimeline 의 Update 핀을 Set Intensity 노드에 연결한 후 Multiply 노드의 Return Value 핀을 Set Intensity 노드의 New Intensity 입력 핀에 연결합니다.
-
PointLight 노드에서 드래그하여 액션 메뉴에서 Set Light Color 를 검색해 선택합니다.
Begin Object Class=/Script/BlueprintGraph.K2Node_CallFunction Name="K2Node_CallFunction_3" FunctionReference=(MemberParent=Class'"/Script/Engine.LightComponent"',MemberName="SetLightColor") NodePosX=1296 NodePosY=64 NodeGuid=43D9BD7C4283FC673F36A1930C3243C6 CustomProperties Pin (PinId=744D0148419A07627F1A9F978A0C575D,PinName="execute",PinToolTip="\nExec",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_CallFunction_2 87A5CA2F43E3E67419AFD1A8953F299B,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=D792D59441A56ECC8C3D4CB3900F9C66,PinName="then",PinToolTip="\nExec",Direction="EGPD_Output",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=FE00319941A34DE91479318F2093ECE0,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "Target", "Target"),PinToolTip="타깃\n라이트 컴포넌트 오브젝트 레퍼런스",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=Class'"/Script/Engine.LightComponent"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_Knot_1 808A85F1410FB25AEFC0C8B494E8DA53,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=BD932EBD48DCC38B6CA11F9AED634AB2,PinName="NewLightColor",PinToolTip="새 라이트 컬러 설정\n선형 컬러 구조체",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=ScriptStruct'"/Script/CoreUObject.LinearColor"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(K2Node_Knot_3 912593C04753CE1C51DEF2B3D7CFA5AD,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) CustomProperties Pin (PinId=6602709A43E5CCC5AB675882406E458C,PinName="bSRGB",PinToolTip="SRGB\n부울",PinType.PinCategory="bool",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="true",AutogeneratedDefaultValue="true",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,) End Object -
PointLightTimeline 노드의 Light Linear Color Track 핀을 Set Light Color 노드의 New Light Color 핀에 연결합니다. 그런 다음 Set Intensity 노드의 실행 핀을 Set Light Color 노드에 연결합니다.
-
컴파일(Compile) 과 저장(Save) 버튼을 클릭합니다.

완성된 블루프린트
레벨 구성
작성한 코드의 기능을 가장 잘 보여주려면 레벨에서 모든 라이트 소스 액터를 제거해야 합니다.
-
콘텐츠 브라우저(Content Browser) 에서 BP_LightActor 에셋을 선택하고 레벨(Level) 로 드래그합니다.
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
-
월드 아웃라이너(World Outliner) 에서 BP_LightActor 를 선택한 후 디테일(Details) 패널로 이동하여 위치(Location) 세팅을 (0, 0, 300) 으로, 스케일(Scale) 세팅을 (10, 10, 10) 으로 설정합니다.
-
월드 아웃라이너(World Outliner) 에서 DirectionalLight 액터(DirectionalLight Actor) 를 삭제합니다.
-
레벨이 다음과 같아야 합니다.
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
최종 결과
이제 라이트 액터와 레벨이 설정되었으므로, Play (PIE) 를 클릭해 관전자 폰에 자동으로 빙의합니다.
관전자 폰을 제어하고 라이트 액터의 박스 컴포넌트 바운드를 탐색할 수 있습니다.
타임라인 컴포넌트의 플레이 기능이 트리거되면 라이트의 컬러 및 밝기가 5초에 걸쳐 변하기 시작합니다.

이 문서는 색이 변하고 접촉 시 천천히 흐려지는 라이트 액터를 설정하는 방법을 설명합니다.
이는 오버랩 트리거로 작동하는 박스 컴포넌트와 포인트 라이트 액터를 조작하는 타임라인 컴포넌트를 포함한 포인트 라이트 컴포넌트를 통해 이뤄집니다.

페이딩 라이트 액터 만들기
-
기본(Blank) 템플릿 기반의 새로운 C++ 프로젝트를 만들고 FadingLights 라고 명명합니다.
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
-
콘텐츠 브라우저(Content Browser) 로 이동하여 C++ 클래스(C++ Classes) 폴더를 클릭한 다음 + 추가(Add) 버튼을 클릭하고 새 C++ 클래스(New C++ Class) 를 선택합니다.
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
-
액터(Actor) 를 부모 클래스(Parent Class) 로 선택합니다.
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
-
생성된 액터의 이름을 LightActor 로 지정합니다.
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
-
새 액터가 생성되면 Visual Studio 가 자동으로
LightActor.h
및LightActor.cpp
파일을 엽니다.LightActor.h
파일로 이동한 뒤 다음을 선언합니다.LightActor.h
#include "Components/TimelineComponent.h"
-
LightActor
클래스 정의에 다음 코드를 추가합니다.LightActor.h
public: UPROPERTY(EditAnywhere) UCurveFloat* PointLightFloatCurve; UPROPERTY(EditAnywhere) UCurveLinearColor* PointLightColorCurve; protected: //포인트 라이트 컴포넌트를 애니메이팅하는 TimelineComponent UPROPERTY(VisibleAnywhere, BlueprintReadWrite) UTimelineComponent* LightTimelineComp; //근접성 오버랩 볼륨으로 사용할 BoxComponent UPROPERTY(EditAnywhere, BlueprintReadWrite) class UBoxComponent* LightOverlapVolume; UPROPERTY(EditAnywhere,BlueprintReadWrite) class UPointLightComponent* PointLightComp; //포인트 라이트 밝기에 사용되는 트랙 FOnTimelineFloat UpdateBrightnessTrack; //포인트 라이트 컬러에 사용되는 트랙 FOnTimelineLinearColor UpdateColorTrack; //UpdateBrightnessTrack에 상대적으로 라이트의 밝기를 업데이트하는 함수 UFUNCTION() void UpdateLightBrightness(float BrightnessOutput); //UpdateColorTrack에 상대적으로 라이트의 컬러를 업데이트하는 함수 UFUNCTION() void UpdateLightColor(FLinearColor ColorOutput); UPROPERTY(EditDefaultsOnly) float BrightnessMultiplier;
-
LightActor.cpp
로 이동하여 다음 클래스 라이브러리를 추가합니다.LightActor.cpp
#include "Components/BoxComponent.h" #include "Components/PointLightComponent.h"
-
ALightActor::ALightActor
의 생성자에서 다음을 선언합니다.LightActor.cpp
ALightActor::ALightActor() { // 이 액터가 프레임마다 Tick()을 호출하도록 설정합니다. 필요 없는 경우 퍼포먼스 향상을 위해 이 설정을 끌 수 있습니다. PrimaryActorTick.bCanEverTick = true; //디폴트 컴포넌트 생성 PointLightComp = CreateDefaultSubobject<UPointLightComponent>(TEXT("PointLightComp")); LightTimelineComp = CreateDefaultSubobject<UTimelineComponent>(TEXT("LightTimelineComp")); LightOverlapVolume = CreateDefaultSubobject<UBoxComponent>(TEXT("LightOverlapVolume")); //어태치먼트 구성 RootComponent = LightOverlapVolume; PointLightComp->AttachToComponent(LightOverlapVolume, FAttachmentTransformRules::KeepRelativeTransform); //밝기 배수 초기화 BrightnessMultiplier = 20.0f; }
-
그런 다음, 포인트 라이트 컴포넌트의
UFunction
메서드를 구현합니다.LightActor.cpp
void ALightActor::UpdateLightBrightness(float BrightnessOutput) { PointLightComp->SetLightBrightness(BrightnessOutput * 20.0f); }
void ALightActor::UpdateLightColor(FLinearColor ColorOutput) { PointLightComp->SetLightColor(ColorOutput); }
-
그런 다음,
BeginPlay
메서드에 다음 코드를 추가합니다.LightActor.cpp
void ALightActor::BeginPlay() { Super::BeginPlay(); //플로트 및 컬러 트랙을 해당하는 각 함수에 바인딩 UpdateBrightnessTrack.BindDynamic(this, &ALightActor::UpdateLightBrightness); UpdateColorTrack.BindDynamic(this, &ALightActor::UpdateLightColor); //플로트 커브가 있는 경우 그래프를 업데이트 함수에 바인딩 if (PointLightFloatCurve) { LightTimelineComp->AddInterpFloat(PointLightFloatCurve, UpdateBrightnessTrack); } //선형 컬러 커브가 있는 경우 그래프를 업데이트 함수에 바인딩 if (PointLightColorCurve) { LightTimelineComp->AddInterpLinearColor(PointLightColorCurve, UpdateColorTrack); } }
-
코드를 컴파일합니다.
-
콘텐츠 브라우저(Content Browser) 에서 C++ 클래스 폴더 로 이동합니다.
-
LightActor 를 우클릭한 다음 LightActor를 바탕으로 블루프린트 클래스 생성(Create Blueprint Class based on LightActor) 을 선택하고 블루프린트 액터의 이름을 BP_LightActor 로 설정합니다.
BP_LightActor의 클래스 디폴트가 아래와 같은 모습으로 나타납니다.
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
작업 중인 코드
LightActor.h
//Copyright 1998-2022 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Components/TimelineComponent.h"
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "LightActor.generated.h"
UCLASS()
class FADINGLIGHTS_API ALightActor : public AActor
{
GENERATED_BODY()
public:
// 이 액터 프로퍼티의 디폴트값 설정
ALightActor();
protected:
// 게임 시작 시 또는 스폰 시 호출
virtual void BeginPlay() override;
public:
// 모든 프레임에서 호출
virtual void Tick(float DeltaTime) override;
public:
UPROPERTY(EditAnywhere)
UCurveFloat* PointLightFloatCurve;
UPROPERTY(EditAnywhere)
UCurveLinearColor* PointLightColorCurve;
protected:
//포인트 라이트 컴포넌트를 애니메이팅하는 TimelineComponent
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
UTimelineComponent* LightTimelineComp;
//근접성 오버랩 볼륨으로 사용할 BoxComponent
UPROPERTY(EditAnywhere, BlueprintReadWrite)
class UBoxComponent* LightOverlapVolume;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
class UPointLightComponent* PointLightComp;
//포인트 라이트 밝기에 사용되는 트랙
FOnTimelineFloat UpdateBrightnessTrack;
//포인트 라이트 컬러에 사용되는 트랙
FOnTimelineLinearColor UpdateColorTrack;
//UpdateBrightnessTrack에 상대적으로 라이트의 밝기를 업데이트하는 함수
UFUNCTION()
void UpdateLightBrightness(float BrightnessOutput);
//UpdateColorTrack에 상대적으로 라이트의 컬러를 업데이트하는 함수
UFUNCTION()
void UpdateLightColor(FLinearColor ColorOutput);
UPROPERTY(EditDefaultsOnly)
float BrightnessMultiplier;
};
LightActor.cpp
//Copyright 1998-2022 Epic Games, Inc. All Rights Reserved.
#include "LightActor.h"
#include "Components/BoxComponent.h"
#include "Components/PointLightComponent.h"
// 디폴트값 설정
ALightActor::ALightActor()
{
// 이 액터가 프레임마다 Tick()을 호출하도록 설정합니다. 필요 없는 경우 퍼포먼스 향상을 위해 이 설정을 끌 수 있습니다.
PrimaryActorTick.bCanEverTick = true;
//디폴트 컴포넌트 생성
PointLightComp = CreateDefaultSubobject<UPointLightComponent>(TEXT("PointLightComp"));
LightTimelineComp = CreateDefaultSubobject<UTimelineComponent>(TEXT("LightTimelineComp"));
LightOverlapVolume = CreateDefaultSubobject<UBoxComponent>(TEXT("LightOverlapVolume"));
//어태치먼트 구성
RootComponent = LightOverlapVolume;
PointLightComp->AttachToComponent(LightOverlapVolume, FAttachmentTransformRules::KeepRelativeTransform);
//밝기 배수 초기화
BrightnessMultiplier = 20.0f;
}
// 게임 시작 시 또는 스폰 시 호출
void ALightActor::BeginPlay()
{
Super::BeginPlay();
//플로트 및 컬러 트랙을 해당하는 각 함수에 바인딩
UpdateBrightnessTrack.BindDynamic(this, &ALightActor::UpdateLightBrightness);
UpdateColorTrack.BindDynamic(this, &ALightActor::UpdateLightColor);
//플로트 커브가 있는 경우 그래프를 업데이트 함수에 바인딩
if (PointLightFloatCurve)
{
LightTimelineComp->AddInterpFloat(PointLightFloatCurve, UpdateBrightnessTrack);
}
//선형 컬러 커브가 있는 경우 그래프를 업데이트 함수에 바인딩
if (PointLightColorCurve)
{
LightTimelineComp->AddInterpLinearColor(PointLightColorCurve, UpdateColorTrack);
}
}
// 모든 프레임에서 호출
void ALightActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
void ALightActor::UpdateLightBrightness(float BrightnessOutput)
{
PointLightComp->SetLightBrightness(BrightnessOutput * 20.0f);
}
void ALightActor::UpdateLightColor(FLinearColor ColorOutput)
{
PointLightComp->SetLightColor(ColorOutput);
}
콜리전 오버랩 이벤트 생성 및 바인딩
박스 컴포넌트에는 액터가 콜리전 바운드에 들어갈 때 TimelineComponent 를 트리거하는 기능이 필요합니다.
-
LightActor.h
파일의 클래스 정의로 이동한 뒤BrightnessMultiplier
아래에 다음을 선언합니다.LightActor.h
protected: UFUNCTION() void OnOverlapBegin(class UPrimitiveComponent* OverlappedComp, class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
-
LightActor.cpp
파일로 이동한 뒤OnOverlapBegin
함수를 구현합니다.LightActor.cpp
void ALightActor::OnOverlapBegin(class UPrimitiveComponent* OverlappedComp, class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult) { LightTimelineComp->Play(); }
-
아래와 같이 오버랩 함수를
BeginPlay
메서드에 바인딩합니다.LightActor.cpp
~~~ //박스 컴포넌트를 라이트 액터의 오버랩 함수에 바인딩 LightOverlapVolume->OnComponentBeginOverlap.AddDynamic(this, &ALightActor::OnOverlapBegin); ~~~
-
코드를 컴파일합니다.
완료된 코드
LightActor.h
//Copyright 1998-2022 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Components/TimelineComponent.h"
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "LightActor.generated.h"
UCLASS()
class FADINGLIGHTS_API ALightActor : public AActor
{
GENERATED_BODY()
public:
// 이 액터 프로퍼티의 디폴트값 설정
ALightActor();
protected:
// 게임 시작 시 또는 스폰 시 호출
virtual void BeginPlay() override;
public:
// 모든 프레임에서 호출
virtual void Tick(float DeltaTime) override;
public:
UPROPERTY(EditAnywhere)
UCurveFloat* PointLightFloatCurve;
UPROPERTY(EditAnywhere)
UCurveLinearColor* PointLightColorCurve;
protected:
//포인트 라이트 컴포넌트를 애니메이팅하는 TimelineComponent
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
UTimelineComponent* LightTimelineComp;
//근접성 오버랩 볼륨으로 사용할 BoxComponent
UPROPERTY(EditAnywhere, BlueprintReadWrite)
class UBoxComponent* LightOverlapVolume;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
class UPointLightComponent* PointLightComp;
//포인트 라이트 밝기에 사용되는 트랙
FOnTimelineFloat UpdateBrightnessTrack;
//포인트 라이트 컬러에 사용되는 트랙
FOnTimelineLinearColor UpdateColorTrack;
//UpdateBrightnessTrack에 상대적으로 라이트의 밝기를 업데이트하는 함수
UFUNCTION()
void UpdateLightBrightness(float BrightnessOutput);
//UpdateColorTrack에 상대적으로 라이트의 컬러를 업데이트하는 함수
UFUNCTION()
void UpdateLightColor(FLinearColor ColorOutput);
UPROPERTY(EditDefaultsOnly)
float BrightnessMultiplier;
protected:
UFUNCTION()
void OnOverlapBegin(class UPrimitiveComponent* OverlappedComp, class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
};
LightActor.cpp
//Copyright 1998-2022 Epic Games, Inc. All Rights Reserved.
// 프로젝트 세팅의 설명 페이지에 저작권 고지를 작성합니다.
#include "LightActor.h"
#include "Components/BoxComponent.h"
#include "Components/PointLightComponent.h"
// 디폴트값 설정
ALightActor::ALightActor()
{
// 이 액터가 프레임마다 Tick()을 호출하도록 설정합니다. 필요 없는 경우 퍼포먼스 향상을 위해 이 설정을 끌 수 있습니다.
PrimaryActorTick.bCanEverTick = true;
//디폴트 컴포넌트 생성
PointLightComp = CreateDefaultSubobject<UPointLightComponent>(TEXT("PointLightComp"));
LightTimelineComp = CreateDefaultSubobject<UTimelineComponent>(TEXT("LightTimelineComp"));
LightOverlapVolume = CreateDefaultSubobject<UBoxComponent>(TEXT("LightOverlapVolume"));
//어태치먼트 구성
RootComponent = LightOverlapVolume;
PointLightComp->AttachToComponent(LightOverlapVolume, FAttachmentTransformRules::KeepRelativeTransform);
//밝기 배수 초기화
BrightnessMultiplier = 20.0f;
}
// 게임 시작 시 또는 스폰 시 호출
void ALightActor::BeginPlay()
{
Super::BeginPlay();
//플로트 및 컬러 트랙을 해당하는 각 함수에 바인딩
UpdateBrightnessTrack.BindDynamic(this, &ALightActor::UpdateLightBrightness);
UpdateColorTrack.BindDynamic(this, &ALightActor::UpdateLightColor);
//플로트 커브가 있는 경우 그래프를 업데이트 함수에 바인딩
if (PointLightFloatCurve)
{
LightTimelineComp->AddInterpFloat(PointLightFloatCurve, UpdateBrightnessTrack);
}
//선형 컬러 커브가 있는 경우 그래프를 업데이트 함수에 바인딩
if (PointLightColorCurve)
{
LightTimelineComp->AddInterpLinearColor(PointLightColorCurve, UpdateColorTrack);
}
//박스 컴포넌트를 라이트 액터의 오버랩 함수에 바인딩
LightOverlapVolume->OnComponentBeginOverlap.AddDynamic(this, &ALightActor::OnOverlapBegin);
}
// 모든 프레임에서 호출
void ALightActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
void ALightActor::UpdateLightBrightness(float BrightnessOutput)
{
PointLightComp->SetLightBrightness(BrightnessOutput * 20.0f);
}
void ALightActor::UpdateLightColor(FLinearColor ColorOutput)
{
PointLightComp->SetLightColor(ColorOutput);
}
void ALightActor::OnOverlapBegin(class UPrimitiveComponent* OverlappedComp, class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
LightTimelineComp->Play();
}
밝기 트랙 설정하기
플레이어가 라이트 액터의 박스 컴포넌트 바운드에 오버랩되는 경우, 타임라인 컴포넌트에는 포인트 라이트 컴포넌트의 밝기 값을 조작할 플로트 커브가 필요합니다.
밝기의 초기 값은 5000 이며, 5초 에 걸쳐 0 으로 감소합니다.
-
콘텐츠 브라우저(Content Browser) 로 이동하여 + 추가(+ Add) > 기타(Miscellaneous) > 커브(Curve) 를 선택합니다.
-
CurveFloat 를 선택하고 에셋의 이름을 BrightnessCurveFloat 로 지정합니다.
-
BrightnessCurveFloat 를 더블클릭해 타임라인 에디터(Timeline Editor) 를 엽니다.
-
그래프(Graph) 를 우클릭해 플로트 커브에 2개의 키를 추가한 후 키 추가(Add Key) 를 선택합니다. 첫 번째 키의 시간 값을 (0, 5000) 으로 조정합니다. 두 번째 키의 시간 값을 (5, 0) 으로 조정합니다. BrightnessCurveFloat 가 다음과 같이 보여야 합니다.
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
-
BrightnessCurveFloat 를 저장한 후 콘텐츠 브라우저(Content Browser) 로 돌아와 BP_LightActor 를 더블클릭해 클래스 디폴트(Class Defaults) 를 엽니다.
-
디테일(Details) 패널로 이동해 포인트 라이트 플로트 커브(Point Light Float Curve) 드롭다운 메뉴에서 밝기 커브 플로트(Brightness Curve Float) 를 선택합니다.
-
컴파일(Compile) 과 저장(Save) 버튼을 클릭합니다.
컬러 트랙 설정하기
플레이어가 라이트 액터의 박스 컴포넌트 바운드에 오버랩되는 경우, 포인트 라이트 타임라인에는 포인트 라이트 컴포넌트의 컬러 프로퍼티를 조작할 선형 컬러 커브 트랙이 필요합니다.
-
콘텐츠 브라우저(Content Browser) 로 이동하여 + 추가(+ Add) > 기타(Miscellaneous) > 커브(Curve) 를 선택합니다.
-
CurveLinearColor 를 선택하고 에셋의 이름을 LinearColorCurve 로 지정합니다.
-
LinearColorCurve 를 더블클릭해 타임라인 에디터(Timeline Editor) 를 엽니다.
-
첫 번째 컬러 키를 더블클릭해 RGB 값을 ( R: 1, G: 0.665, B: 0.015)로 변경합니다.
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
-
두 번째 컬러 키를 더블 클릭해 RGB 값을 ( R: 0, G: 0, B: 0)로 변경합니다.
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
-
그래프(Graph) 를 클릭하여 두 번째 포인트(Point) 를 선택하고 시간을 5초 로 설정합니다.
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
-
LinearColorCurve 가 다음과 같이 보여야 합니다.
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
-
LinearColorCurve 를 저장한 후 콘텐츠 브라우저(Content Browser)로 돌아와 BP_LightActor 를 더블클릭해 클래스 디폴트를 엽니다.
-
디테일 패널(Details Panel) 로 이동해 포인트 라이트 플로트 커브(Point Light Float Curve) 드롭다운 메뉴에서 밝기 커브 플로트(Brightness Curve Float) 를 선택합니다.
-
컴파일(Compile) 과 저장(Save) 버튼을 클릭합니다.
레벨 구성
작성한 코드의 기능을 가장 잘 보여주려면 레벨에서 모든 라이트 소스 액터를 제거해야 합니다.
-
콘텐츠 브라우저(Content Browser) 에서 BP_LightActor 에셋을 선택하고 레벨(Level) 로 드래그합니다.
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
-
월드 아웃라이너(World Outliner) 에서 BP_LightActor 를 선택한 후 디테일(Details) 패널로 이동하여 위치(Location) 세팅을 (0, 0, 300) 으로, 스케일(Scale) 세팅을 (10, 10, 10) 으로 설정합니다.
-
월드 아웃라이너(World Outliner) 에서 DirectionalLight 액터(DirectionalLight Actor) 를 삭제합니다.
-
레벨이 다음과 같아야 합니다.
이미지를 클릭하면 최대 크기로 볼 수 있습니다.
최종 결과
이제 라이트 액터와 레벨이 설정되었으므로, Play (PIE) 를 클릭해 관전자 폰에 자동으로 빙의합니다.
관전자 폰을 제어하고 라이트 액터의 박스 컴포넌트 바운드를 탐색할 수 있습니다.
타임라인 컴포넌트의 플레이 기능이 트리거되면 라이트의 컬러 및 밝기가 5초에 걸쳐 변하기 시작합니다.
