Spawning lights at night time

I have a city level with movable sunlight + atmospheric fog. I would like to know if its possible to spawn movable lights on my lightpoles when the sun is nearing the horizon. I have the lightpoles blueprint setup with spawn function but not sure how to spawn lights when its night time.

You can either create the light component with the rest of the lamp post and just toggle it’s visibility, or use the AddComponent node to create it at runtime.

Hi James,

I know about visibility and AddComponent but my question was how can i spawn them at night time only. In my current level i can move the suns direction using mouse wheel. So when the sun gets near to the horizon i want these lightpoles to spawn lights. The lightpole itself is a blueprint asset but am not sure how to make this blueprint know that the sun is near the horizon so it can spawn lights. I hope you got the idea. :slight_smile:

how are you moving the sun with mousewheel?

how is that set up exactly?

Rama

There are mouse scroll up and down events. In Level Blueprint am using those events to update the suns position. Mouse scroll up will change suns pitch and CTRL + Scroll up will update Sun Yaw. Same setup is for Scroll Down.

I’ll be posting all the details on Rocket forum with screenshots of all blueprints. I am waiting for the answer to this question so i could include this too (assuming this is possible).

I am wanting to know the specifics of how you are setting the sun’s position

because then you can determine when it is nighttime based on the exact values of the sun’s position, if you output the raw numbers of the sun’s position to the screen you can gauge what qualifies as “sunset” or below.

Exactly. Am already using that method to set suns evening color. I have printed suns position to the screen and got the value and its all set. But my question is how can i pass that value to my lightpole blueprint? Note that they are assigned only at runtime.

see my answer above :slight_smile:

oooooooooooh

so your is issue is you are wanting to communicate across blueprints

got it

What you want is Blueprint Interfaces

"Adding Functions
Functions are the primary component of an Interface. Interface functions have no implementation. They exist simply as a definition of inputs and outputs. These can be used to send data through the interface, "


:slight_smile:

there’s a forum discussion about cross blueprint communication using interfaces here:

"It looks like I can’t access the variables of a blueprint from another blueprint "
http://forums.epicgames.com/threads/974326-Game-Jam-Mougli-s-thread?p=31669687&viewfull=1#post31669687


Passing Data Through Blueprint Functions


Lauren Ridge:
Make sure to add the interface to both the Blueprint that you want to call the interface (for example, a planet) and the Blueprint that you want to implement the interface (for example, a moon).

More links and details in her entire post:

Hi Rama,

I am already using interfaces but still its not working. To better illustrate the problem i’ll post some screenies.

So in my RoadSideWalk Blueprints am spawning Lightpole_BP like this:

Then in my Sun_BP am calling the interface functions like this (I can see both print strings on my screen):

And this is my Lightpole_BP events that never get fired. These events are there to make the lights illuminate. :frowning:

My doubt is since am spawning new instances using SpawnActor, these Interface Events in Sun_BP are not registered for the new instances…am i right?

does the interface exist in the lightpole as well? Something Lauren mentioned?

That both classes must have it?

I cant help much here since I dont use blueprints myself, hopefully someone else with more experience can assist :slight_smile:

Wishing you luck with this!

Rama

Yes both Lightpole_BP and Sun_BP have the interface.

can you please post at least part 1 of your sun tutorial soon

I really really wanna know how to move the sun around in the sky :slight_smile:

I never figured it out in UE3 :slight_smile:

Rama

Am going to post a new thread on Rocket forum. I will explain sun movement there plus some other stuff. :slight_smile: