I'm trying to modify the beaconSpin.lua function in BeamNG to create an oscillating (side-to-side) motion for a beacon light, instead of having it spin continuously in one direction (360 spin) What I’ve Tried: I created a new function called beaconOscillate based on the existing beaconSpin code. Instead of a full 360° rotation, I attempted to limit it to -30° to 30° using math.sin() in the script. I modified the JBeam props section to use this new function. This is what it looks like. Keep in mind I am new to this, so it's not perfect. Code: -- This Source Code Form is subject to the terms of the bCDDL, v. 1.1. -- If a copy of the bCDDL was not distributed with this -- file, You can obtain one at http://beamng.com/bCDDL-1.1.txt local M = {} M.type = "auxiliary" local oscillationTime = 0 local beaconSpeed = 0 local electricsName = nil local function updateGFX(dt) if electrics.values.lightbar > 0 then oscillationTime = oscillationTime + dt * beaconSpeed local angle = 30 * math.sin(oscillationTime) -- Should oscillate between -30° and 30° electrics.values[electricsName] = angle -- Apply oscillation angle else electrics.values[electricsName] = 0 oscillationTime = 0 end end local function init(jbeamData) beaconSpeed = jbeamData.spinSpeed or 4 -- Adjusted speed for oscillation electricsName = jbeamData.electricsName or "beaconOscillate" electrics.values[electricsName] = 1 end M.init = init M.updateGFX = updateGFX return M Am I missing something in the electrics system to trigger movement? Is there a better way to achieve an oscillating motion within the existing BeamNG prop system? I would like to have a beacon lightbar that oscilates left to right rather than full spin. Here's an example video of what I would like to accomplish:
seems like you changed the electrics name from beaconSpin to beaconOscillate sirens props use beaconSpin's value for its rotation, if you change the name you would need to create custom sirens that use your beaconOscillate value... for each car that has sirens