Best way to have a light move with a floor?

Sun Dec 26, 2021 3:20 pm

As the title says, how can I get a dynamic light to move with a floor (UDMF).

e.g. Imagine I have a dynamic light placed 32 units above a floor. The floor is a lift activated by a line type 62 (platform lower, wait, raise). The thing is, the platform will lower and raise but the light stays at its absolute Z position.

Lift up:

Lift Down:


I thought that there was some way to force actors to move relative to the floor, but I can't see it anywhere.

What I have done in the past (a long time ago) is make an invisible actor with a light attached that (continuing the above example) is set with a vetical offset of 32 units. That way, the actor moves with the platform and, therefore, so does the light. However, this is far from flexible - requiring a new actor for each light size/colour/offset. So, is there a way to make the standard built-in light objects move relative to the floor (or ceiling I guess) when the floor moves?

Re: Best way to have a light move with a floor?

Sun Dec 26, 2021 3:48 pm

Do we get in trouble if we both ask essentially the same question?

Ok, so to get a light that you can move about, you need to define a dynamic light in GLDEFS and bind it to the frames of a dummy object you place in the map.

The solution, at least this is my next attempt at a workaround, is to allow the dummy object to ride the lift (give it gravity), and just offset the light on the Z axis in its GLDEFS definition.

Note that what I present below is the old code, we both need to give the thing gravity and use the GLDEFS offsets.
Spoiler: ZScript for my dummy objects


Spoiler: "GLDEFS Creating/Binding the Lights"


Edit: let me quickly add, Enjay, offset vertically using the Y axis, not Z, the GLDEFS wiki explains that, Y is vertical like a model!

Re: Best way to have a light move with a floor?

Sun Dec 26, 2021 3:55 pm

I think you have just suggested the same method that I mentioned in my post?
Enjay wrote:What I have done in the past (a long time ago) is make an invisible actor with a light attached that (continuing the above example) is set with a vetical offset of 32 units. That way, the actor moves with the platform and, therefore, so does the light. However, this is far from flexible - requiring a new actor for each light size/colour/offset. So, is there a way to make the standard built-in light objects move relative to the floor (or ceiling I guess) when the floor moves?

Re: Best way to have a light move with a floor?

Sun Dec 26, 2021 4:13 pm

Oh, duh, you know what, it's the same method I've used in the past to make stuff like flashlights. Hmm I'm stuck making anything flexible, I think ideally what we both want is to have them follow the same rules as any other actor. My guess is, for example, the pointlight is sort of a baked light by itself and not when bound to another objects frames.

Re: Best way to have a light move with a floor?

Sun Dec 26, 2021 10:30 pm

I have to say that I haven't worked with UDB (I assume you are working with UDB), my editor is much more basic, so what I say is theoretical. But as far as I understand, the light in UDB has fields for light color and light intensity that you can fill, and that's how you work with them. So I would have tried making a new actor that inherits from PointLight (assuming that PointLight is the thing that UDB places in the map when you choose to create a light in that spot), but additionally has a RELATIVETOFLOOR and/or MOVEWITHSECTOR flag(s). Then, if UDB is smart enough, when you place this actor in the map, it's gonna have the same fields available for filling; and when you need a floor-bound light, you place this actor instead of the standard light.

Or, alternatively, one could make a feature request of the UDB developers to have a new checkbox in the properties of a light, call this checkbox "floor-bound" or somesuch; and when this checkbox is ticked, this particular light would be given a MOVEWITHSECTOR flag, or some other flag (or their combination) to ensure that it stays relative to the floor; I'm sure UDB developers would know better which flag(s) to assign.