texture rotation speed from wheelspeed?

Discussion in 'Programming' started by MRcrash, Nov 1, 2017.

  1. MRcrash

    MRcrash
    Expand Collapse
    BeamNG Team

    Joined:
    Dec 12, 2014
    Messages:
    1,231
    I´m noob at programming and I would like to have rotating offset discs on cultivator. As this would be very hard to jbeam (and would require good hardware to run), I think best solution is animated texture. But I don´t want it to rotate always, I would like to get rotating speed from rear wheel wheelspeed (which is jbeamed).
    screenshot_00054.png
    I have tried doing a lua but it didnt work. :confused:
     
  2. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,685
    I suppose it's a series of planes arrayed?
    Try making them a own mesh and using props for that.
     
  3. MRcrash

    MRcrash
    Expand Collapse
    BeamNG Team

    Joined:
    Dec 12, 2014
    Messages:
    1,231
    That sounds like a good idea. But I still don´t know how to make them rotate at same rpm as rear wheel/drum.
    --- Post updated ---
    Edit:
    I took beacon.lua and modified it and in works :)
    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 = {}
    
    local function init()
        electrics.values.discs = 1
    end
    
    
    local function updateGFX(dt)
        local wheelspeed = electrics.values.wheelspeed
        electrics.values.discs = ((electrics.values.discs + (dt * wheelspeed * 320)) % 360) or 0
    end
    
    -- public interface
    M.updateGFX      = updateGFX
    M.onInit      = init
    M.onReset     = init
    return M
     
    • Like Like x 1
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice