Back to search
ExampleEffects

Create a Blueprint for a spotlight that follows the player smoothly using RInterpTo

Updated 3mo ago
UE 5.0UE 5.1UE 5.2UE 5.3UE 5.4UE 5.5UE 5.6UE 5.7#spotlight#follow#smooth#interp#tracking

Blueprint JSON

The structure WoalzCraft generates. Paste into the plugin to instantiate as a real Blueprint.

{
  "nodes": [
    {
      "id": "n_tick",
      "position": {
        "x": 0,
        "y": 0
      },
      "node_type": "EventTick"
    },
    {
      "id": "n_getplayer",
      "position": {
        "x": 100,
        "y": 150
      },
      "node_type": "CallFunction",
      "input_values": {
        "PlayerIndex": "0"
      },
      "function_name": "GetPlayerCharacter"
    },
    {
      "id": "n_playerloc",
      "position": {
        "x": 300,
        "y": 150
      },
      "node_type": "GetActorLocation"
    },
    {
      "id": "n_myloc",
      "position": {
        "x": 100,
        "y": 300
      },
      "node_type": "GetActorLocation"
    },
    {
      "id": "n_findlook",
      "position": {
        "x": 500,
        "y": 200
      },
      "node_type": "CallFunction",
      "function_name": "FindLookAtRotation"
    },
    {
      "id": "n_getrot",
      "position": {
        "x": 300,
        "y": 400
      },
      "node_type": "GetActorRotation"
    },
    {
      "id": "n_rinterp",
      "position": {
        "x": 700,
        "y": 100
      },
      "node_type": "CallFunction",
      "function_name": "RInterpTo"
    },
    {
      "id": "n_getspeed",
      "position": {
        "x": 500,
        "y": 400
      },
      "node_type": "GetVariable",
      "variable_name": "TrackSpeed"
    },
    {
      "id": "n_setrot",
      "position": {
        "x": 950,
        "y": 0
      },
      "node_type": "SetActorRotation"
    }
  ],
  "variables": [
    {
      "name": "TrackSpeed",
      "type": "float",
      "default_value": "3.0"
    }
  ],
  "components": [
    {
      "name": "Root",
      "type": "SceneComponent",
      "is_root": true
    },
    {
      "name": "SpotLight",
      "type": "SpotLightComponent",
      "parent": "Root"
    }
  ],
  "connections": [
    {
      "to_pin": "execute",
      "to_node": "n_setrot",
      "from_pin": "then",
      "from_node": "n_tick"
    },
    {
      "to_pin": "self",
      "to_node": "n_playerloc",
      "from_pin": "ReturnValue",
      "from_node": "n_getplayer"
    },
    {
      "to_pin": "Start",
      "to_node": "n_findlook",
      "from_pin": "ReturnValue",
      "from_node": "n_myloc"
    },
    {
      "to_pin": "Target",
      "to_node": "n_findlook",
      "from_pin": "ReturnValue",
      "from_node": "n_playerloc"
    },
    {
      "to_pin": "Current",
      "to_node": "n_rinterp",
      "from_pin": "ReturnValue",
      "from_node": "n_getrot"
    },
    {
      "to_pin": "Target",
      "to_node": "n_rinterp",
      "from_pin": "ReturnValue",
      "from_node": "n_findlook"
    },
    {
      "to_pin": "DeltaTime",
      "to_node": "n_rinterp",
      "from_pin": "Delta Seconds",
      "from_node": "n_tick"
    },
    {
      "to_pin": "InterpSpeed",
      "to_node": "n_rinterp",
      "from_pin": "TrackSpeed",
      "from_node": "n_getspeed"
    },
    {
      "to_pin": "NewRotation",
      "to_node": "n_setrot",
      "from_pin": "ReturnValue",
      "from_node": "n_rinterp"
    }
  ],
  "parent_class": "Actor",
  "blueprint_name": "BP_TrackingSpotlight"
}