Enviromental Trigger (Lua Gravity) not working...

Discussion in 'World Editor' started by havocNG, Apr 20, 2022.

  1. havocNG

    havocNG
    Expand Collapse

    Joined:
    May 27, 2019
    Messages:
    101
    I cant get the "Environmental Trigger" (gravity) to work, this is the script Im using, is this correct?

    local function myGravityTrigger (data)
    if data.event == "enter" then
    environment.setGravity(0)
    else
    environment.setGravity(-9.81)
    end
    end

    return myGravityTrigger
     
  2. Mopman93

    Mopman93
    Expand Collapse
    BeamNG Team

    Joined:
    Jun 24, 2017
    Messages:
    125
    you need to use "core_environment" and also the name of your function needs to be at the bottom like this:

    Code:
    local function myGravityTrigger (data)
        if data.event == "enter" then
            core_environment.setGravity(0)
        else
            core_environment.setGravity(-9.81)
        end
    end
    
    myGravityTrigger
     
    • Like Like x 1
  3. havocNG

    havocNG
    Expand Collapse

    Joined:
    May 27, 2019
    Messages:
    101

    Thank You I will try it right now...
    --- Post updated ---
    That worked, awesome Thank You.
     
  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