Auto rotate light beam blueprint

Hey guys!
So I downloaded the Blueprints project and migrated the BP_LightBeam into my own project. I positioned it where my spotlight is and checked “Use Light For Rotation” and the light beam immediately snaps to the rotation of my spotlight which is awesome. However, if I rotate the spotlight, the light beam blueprint does not update the rotation unless I uncheck/check the “Use Light for rotation” button again.
Attached the blueprint’s rotation section. How do I make it constantly update the rotation whenever I change the spotlight’s rotation so I don’t have to manually uncheck/check every time?

Here’s more info in the docs about the light beam blueprint:

You need to take that piece of code and put it on tick.

Yes, just plop this in the event tab :slight_smile:

Hey! Thanks for the quick response. I apologize my blueprint scripting knowledge is fairly limited. This entire blueprint is created in the Construction Script tab. The Event Graph tab is completely empty. And I can only create this Event Tick node in the Event Graph and not in Construction Script.

So do I just copy all these nodes to event graph, then disconnect the branch node and instead connect the tick like you did?

Thank you for the help!

I copied all the nodes, pasted them in event graph tab, disconnected the True output of the Branch node and connected the event tick, saved and compiled it. It still doesn’t update automatically every time I rotate the spotlight. Only when I check/uncheck the “Use Light for rotation” box is when it updates. Am I missing something?

No no, sorry. Just leave the construct script as is, and put my bit of code into the event graph…

Ok, so I cleared the event graph tab completely, the construct script tab is as it was before. I simply copied those 4 nodes from construct script to event tab: “Light, GetActorRotation, GodRayMesh and SetRelativeRotation”. Created event tick node and plugged it in SetRelativeRotation as you did above.
Saved, compiled. Still not updating automatically but only updating with check/uncheck.

I apologize if I am doing something wrong.

No - reset :slight_smile:

I’m assuming the original BP only had stuff in the construct script? If that’s so, then:

Imagine the BP is totally fresh, you have done nothing.

  1. Put the nodes I’ve shown above into the event graph.

That’s it :slight_smile:

Yes correct, thats what I did. Fresh BP with no changes, event graph is empty.
Created those 4 nodes from scratch this time, dragged the Light and GodRayMesh variables from the left, created other nodes inside event graph, connected them like you have and saved and compiled. Still no luck.

Attaching the image with the view of my event and construct tabs. I took screenshot as i hit compile so you can see the flow of logic in the construct tab in the thick dull orange line, if that helps understand the cause of the issue.

I really appreciate your help. :slight_smile:

I’m creating the project to take a look…

Do you want the BP to copy the rotation of the spot light when you’re moving it in the editor or at runtime?

I don’t think there’s a solution to make the god ray copy your spotlight rotation in the editor. The construction script only runs when you place an actor, or move it ( or change it’s qualities ).

I’m afraid the solution I gave you only works at runtime, if your spotlight was rotating during play, the god ray would follow it.

Sorry if I’ve wasted a load of time. Please come back if I can help further…

Thank you so much for taking the time!
I want the BP Light Beam to update when I move the spotlight in the editor. I am not using this for game or anything, just for a cinematic that I will later render from sequencer.

Yes, fiddled around a bit. The only way you can do that is to turn the spotlight into a blueprint which has a reference to the god ray and uses it’s own constructon script to move the god ray sheet.

Bit of a pain, I think you might agree… :-/

Yeah i ended up just creating a spotlight inside the BP, that way rotating the whole BP rotates the light and the light beam together. Will mark this as solved but I hope there is a quicker way of doing this without having to create a spotlight inside the BP.
Thanks for the help!