Priorize lighting rendering

Imagine a car that moves like 100 studs per 10 seconds or more with lights at night.With new roblox update the light will not appear beacuse it cant be faster than the car so… There is a way to priorize lighting rendering? My unique idea is network ownership but I dont really know how to use it with light. Any idea?

1 Like

I don’t know much about scripting however have you tried the Network Ownership feature?

This feature allows you to control which player has authority over an object in the game, which can affect how it is rendered on the player’s screen.

To use this feature with lighting, you can create a script that assigns network ownership to the player who is driving the car. This can be done by using the SetNetworkOwnership() method on the lighting object, passing in the player’s ID as the argument.

Here is an example script, I’m very bad when it comes to scripting but I hope this at least helps you out.

local lights = -- get a reference to the lights object
local car = -- get reference to car object

while true do
    -- check if the car is being driven by a player
    local driver = car:GetDriver()
    if driver then
        -- set network ownership of the lights to the driver
        lights:SetNetworkOwnership(driver)
    end
    wait(1)
end
1 Like

This is not really possible with the way lighting works.

The light system is voxel based, e.g. the entire world is split into cubes (voxels) with the light colors & brightnesses. When something with a light in it moves, the engine has to update the new voxels and the old voxels, which is expensive, and so the engine doesn’t do it very often.

The engine doesn’t provide any ways to control that.

2 Likes

wait you are the one of wos.Thats sad to know , you think is impossible to do something like this ? you have atleast one idea for do a thing like this? What about use tick() and other stuff to predict lighting?

As @Hexcede stated, you have no control over this.

You do have control however, over where the lights are placed. If the car is running, you might be able to hide the “lag” by placing the light a bit further in the direction the car is travelling, relative to the speed.

Here’s a mock implementation:

RunService.Heartbeat:Connect(function(dt)
    local lightPosition = --> the origin position of the light
    local carDirection = --> the unit vector direction of the car
    local carSpeed = --> how fast the car travels in studs/s, or whatever you use to measure the speed

    Light.Position = lightPosition + carDirection * (carspeed * dt)
end)
1 Like

I think I can try this with some implementations.Thanks , I will send the result when I try it!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.