# BP_Door

- Kind: Blueprint (Normal)
- Path: `/Game/Demo/BP_Door`
- Parent class: Actor (`/Script/Engine.Actor`)
- Description: A door that opens for the first actor that walks into it.

## Components

- DefaultSceneRoot: SceneComponent
  - Frame: StaticMeshComponent
      - StaticMesh: /Engine/BasicShapes/Cube
      - RelativeScale3D: (X=0.2,Y=1.0,Z=2.0)
  - Trigger: BoxComponent
      - BoxExtent: (X=120.0,Y=120.0,Z=100.0)

## Variables

| Name | Type | Default | Category | Flags | Tooltip |
|---|---|---|---|---|---|
| bIsOpen | Boolean | False |  |  |  |
| OpenAngle | Float (double-precision) | 90.0 | Door | Instance Editable | How far the door swings, in degrees. |
| RequiredKey | Name | Item.Key |  |  |  |

## Functions

### TryOpen(Instigator: Actor Object Reference) -> (Opened: Boolean)

Flags: Public

Description: Opens the door unless it is already open.

```text
TryOpen(Instigator)
  Branch(Condition=bIsOpen)
    True:
      PrintString(InString="Already open")
    False:
      Set bIsOpen = true  // Remember it so the door opens once
      Return(Opened=true)
```

## Graph: EventGraph

```text
Event BeginPlay
  Branch(Condition=(OpenAngle > 0.0))
    True:
      PrintString(InString="Door ready")
      [N8] Set bIsOpen = false
    False:
      PrintString(InString="OpenAngle must be positive")
      -> goto [N8] Set bIsOpen

Event ActorBeginOverlap(OtherActor)
  TryOpen(Instigator=OtherActor)
  Branch(Condition=TryOpen.Opened)
    True:
      PrintString(InString="Door opened")

Not connected to any entry point: Reroute Node
```

## References

Loads with it: `/Engine/BasicShapes/Cube`
