Toggle Light with box Trigger and code.


1. In the Details tab for the TriggerVolume, scroll down to the Blueprint heading.
2. In the Add Level Events for TriggerVolume dropdown, select Add On Actor Begin Overlap.
The Level Blueprint will open, and an Event node for your TriggerVolume will be added automatically.
3. We want to toggle visibility of the light when you enter the room. We need a reference to the light, so go back to the Level Editor and select PointLight1 again.
4. Return to the Level Blueprint.
5. Right-click in an empty area of the graph, and select Add Reference to PointLight1 in the context menu.
6. Click and drag from the blue pin on the PointLight1 reference node into an empty area of the graph to summon the context menu.
7. Search for Visibility in the context menu, and select Toggle Visibility.
8. Now we need to connect the On Actor Begin Overlap node to the Toggle Visibility node, so that the event execution will cause the Toggle Visibility node to execute. Click on the output pin of On Actor Begin Overlap and drag a wire to the input execution pin of Toggle Visibility.
9. Finally, we want the light to turn off when we leave the room. Right-click on the On Actor Begin Overlap node and select Find Actor in Level. This will select the TriggerVolume in the SceneOutliner.
10. Right-click on TriggerVolume3 in the Scene Outliner.
11. Under Level Blueprint Events, hover over Add Event to expand the menu, then select On Actor End Overlap. The Level Blueprint will open, and an Event node for your TriggerVolume will be added automatically.
12. Click on the output pin of On Actor End Overlap and drag a wire to the input execution pin of Toggle Visibility. You may want to click on the On Actor End Overlap and drag it within the graph so it is in a better location.
13. Play In Editor to test your new Blueprint logic!
--------------------------Code Below------------------------------------------------------------------------------


Begin Object Class=K2Node_Literal Name="K2Node_Literal_6"
   Begin Object Class=EdGraphPin Name="EdGraphPin_6166"
   End Object
   Begin Object Name="EdGraphPin_6166"
      PinName="PointLight1"
      PinFriendlyName="PointLight1"
      Direction=EGPD_Output
      PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.PointLight')
      LinkedTo(0)=EdGraphPin'K2Node_VariableGet_1264.EdGraphPin_21625'
   End Object
   ObjectRef=PointLight'/Game/ThirdPersonBP/Maps/ThirdPersonExampleMap.ThirdPersonExampleMap:PersistentLevel.PointLight_1'
   Pins(0)=EdGraphPin'EdGraphPin_6166'
   NodePosX=256
   NodePosY=256
   NodeGuid=68D5CE7548DC2546C407959E58E2919F
End Object
Begin Object Class=K2Node_ActorBoundEvent Name="K2Node_ActorBoundEvent_0"
   Begin Object Class=EdGraphPin Name="EdGraphPin_6138"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_6139"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_6140"
   End Object
   Begin Object Name="EdGraphPin_6138"
      PinName="OutputDelegate"
      Direction=EGPD_Output
      PinType=(PinCategory="delegate",PinSubCategoryMemberReference=(MemberParent=BlueprintGeneratedClass'/Game/ThirdPersonBP/Maps/ThirdPersonExampleMap.ThirdPersonExampleMap_C',MemberName="BndEvt__TriggerBox_1_K2Node_ActorBoundEvent_0_ActorBeginOverlapSignature__DelegateSignature"))
   End Object
   Begin Object Name="EdGraphPin_6139"
      PinName="then"
      Direction=EGPD_Output
      PinType=(PinCategory="exec")
      LinkedTo(0)=EdGraphPin'K2Node_CallFunction_2427.EdGraphPin_21438'
   End Object
   Begin Object Name="EdGraphPin_6140"
      PinName="OtherActor"
      PinToolTip="Other Actor\nActor Reference"
      Direction=EGPD_Output
      PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.Actor')
   End Object
   DelegatePropertyName="OnActorBeginOverlap"
   DelegateOwnerClass=Class'/Script/Engine.Actor'
   EventOwner=TriggerBox'/Game/ThirdPersonBP/Maps/ThirdPersonExampleMap.ThirdPersonExampleMap:PersistentLevel.TriggerBox_1'
   EventReference=(MemberParent=Package'"/Script/Engine"',MemberName="ActorBeginOverlapSignature__DelegateSignature")
   bInternalEvent=True
   CustomFunctionName="BndEvt__TriggerBox_1_K2Node_ActorBoundEvent_0_ActorBeginOverlapSignature__DelegateSignature"
   Pins(0)=EdGraphPin'EdGraphPin_6138'
   Pins(1)=EdGraphPin'EdGraphPin_6139'
   Pins(2)=EdGraphPin'EdGraphPin_6140'
   NodePosX=-192
   NodePosY=48
   NodeGuid=97AD29C2445C71EBD575A18108B681F0
End Object
Begin Object Class=K2Node_ActorBoundEvent Name="K2Node_ActorBoundEvent_38"
   Begin Object Class=EdGraphPin Name="EdGraphPin_6152"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_6153"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_6154"
   End Object
   Begin Object Name="EdGraphPin_6152"
      PinName="OutputDelegate"
      Direction=EGPD_Output
      PinType=(PinCategory="delegate",PinSubCategoryMemberReference=(MemberParent=BlueprintGeneratedClass'/Game/ThirdPersonBP/Maps/ThirdPersonExampleMap.ThirdPersonExampleMap_C',MemberName="BndEvt__TriggerBox_1_K2Node_ActorBoundEvent_38_ActorEndOverlapSignature__DelegateSignature"))
   End Object
   Begin Object Name="EdGraphPin_6153"
      PinName="then"
      Direction=EGPD_Output
      PinType=(PinCategory="exec")
      LinkedTo(0)=EdGraphPin'K2Node_CallFunction_2427.EdGraphPin_21438'
   End Object
   Begin Object Name="EdGraphPin_6154"
      PinName="OtherActor"
      PinToolTip="Other Actor\nActor Reference"
      Direction=EGPD_Output
      PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.Actor')
   End Object
   DelegatePropertyName="OnActorEndOverlap"
   DelegateOwnerClass=Class'/Script/Engine.Actor'
   EventOwner=TriggerBox'/Game/ThirdPersonBP/Maps/ThirdPersonExampleMap.ThirdPersonExampleMap:PersistentLevel.TriggerBox_1'
   EventReference=(MemberParent=Package'"/Script/Engine"',MemberName="ActorEndOverlapSignature__DelegateSignature")
   bInternalEvent=True
   CustomFunctionName="BndEvt__TriggerBox_1_K2Node_ActorBoundEvent_38_ActorEndOverlapSignature__DelegateSignature"
   Pins(0)=EdGraphPin'EdGraphPin_6152'
   Pins(1)=EdGraphPin'EdGraphPin_6153'
   Pins(2)=EdGraphPin'EdGraphPin_6154'
   NodePosX=-192
   NodePosY=144
   NodeGuid=AAABB38F4111166C1C0A5B875C9330B3
End Object
Begin Object Class=K2Node_CallFunction Name="K2Node_CallFunction_2427"
   Begin Object Class=EdGraphPin Name="EdGraphPin_21438"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_21439"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_21440"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_21441"
   End Object
   Begin Object Name="EdGraphPin_21438"
      PinName="execute"
      PinType=(PinCategory="exec")
      LinkedTo(0)=EdGraphPin'K2Node_ActorBoundEvent_0.EdGraphPin_6139'
      LinkedTo(1)=EdGraphPin'K2Node_ActorBoundEvent_38.EdGraphPin_6153'
   End Object
   Begin Object Name="EdGraphPin_21439"
      PinName="then"
      Direction=EGPD_Output
      PinType=(PinCategory="exec")
   End Object
   Begin Object Name="EdGraphPin_21440"
      PinName="self"
      PinFriendlyName="Target"
      PinToolTip="Target\nScene Component Reference"
      PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.SceneComponent')
      LinkedTo(0)=EdGraphPin'K2Node_VariableGet_1264.EdGraphPin_21624'
   End Object
   Begin Object Name="EdGraphPin_21441"
      PinName="bPropagateToChildren"
      PinToolTip="Propagate to Children\nBoolean"
      PinType=(PinCategory="bool")
      DefaultValue="false"
      AutogeneratedDefaultValue="false"
   End Object
   FunctionReference=(MemberParent=Class'/Script/Engine.SceneComponent',MemberName="ToggleVisibility")
   Pins(0)=EdGraphPin'EdGraphPin_21438'
   Pins(1)=EdGraphPin'EdGraphPin_21439'
   Pins(2)=EdGraphPin'EdGraphPin_21440'
   Pins(3)=EdGraphPin'EdGraphPin_21441'
   NodePosX=176
   NodePosY=48
   NodeGuid=0B85BDD94945A17A731C0AB5FDA4927A
End Object
Begin Object Class=K2Node_VariableGet Name="K2Node_VariableGet_1264"
   Begin Object Class=EdGraphPin Name="EdGraphPin_21625"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_21624"
   End Object
   Begin Object Name="EdGraphPin_21625"
      PinName="self"
      PinFriendlyName="Target"
      PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.Light')
      LinkedTo(0)=EdGraphPin'K2Node_Literal_6.EdGraphPin_6166'
   End Object
   Begin Object Name="EdGraphPin_21624"
      PinName="LightComponent"
      Direction=EGPD_Output
      PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.LightComponent')
      LinkedTo(0)=EdGraphPin'K2Node_CallFunction_2427.EdGraphPin_21440'
   End Object
   VariableReference=(MemberParent=Class'/Script/Engine.Light',MemberName="LightComponent")
   Pins(0)=EdGraphPin'EdGraphPin_21624'
   Pins(1)=EdGraphPin'EdGraphPin_21625'
   NodePosX=192
   NodePosY=192
   NodeGuid=76DF45DB42DB284BDD6E1B91AE3BAA25
End Object
Begin Object Class=EdGraphNode_Comment Name="EdGraphNode_Comment_50"
   NodePosX=-240
   NodeWidth=715
   NodeHeight=346
   NodeComment="ToggleLights"
   NodeGuid=0763B6E94E6B00117CF671A6BBDDD32C
End Object

Share on Google Plus

About knut

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment

0 comments:

Post a Comment