Solved Different gravity-settings

Discussion in 'Mod Support' started by MysteryManGER, Feb 2, 2017.

  1. MysteryManGER

    MysteryManGER
    Expand Collapse

    Joined:
    May 25, 2016
    Messages:
    647
    Hey!

    I was wondering if it is possible to have two different gravity settings? I mean, if you start the map, you'll have the standard earth gravity (-9,81) ...but if you enter a "zone" you'll have moon-gravity for example.

    I tried to insert a "BeamNG Environment Trigger" and changed the gravity value...but nothing happened when I enter the zone.

    Thanks in advance!

    Michael (MysterManGER)
     
  2. meywue

    meywue
    Expand Collapse
    Administrator
    BeamNG Team

    Joined:
    Nov 19, 2015
    Messages:
    339
    Hey,

    you can use BeamNGTrigger for that which will execute the corresponding lua code.



    Go to Library -> Level -> BeamNG (top right corner) and create a BeamNG Lua Trigger. Once created you can add lua code to the luaFunction field.

    Accordingly to your request I have this little code snippet for you:

    Code:
    local function myGravityTrigger (data)
      if data.event == "enter" then
        environment.setGravity(0)
      else
        environment.setGravity(-9.81)
      end
    end
    
    return myGravityTrigger
    This will execute the local function myGravityTrigger. If you enter the trigger we set the gravity to 0, once we leave it we set the gravity to the default value again.

    If you have questions, don't hesitate to ask.
     
    • Like Like x 4
  3. MysteryManGER

    MysteryManGER
    Expand Collapse

    Joined:
    May 25, 2016
    Messages:
    647
    Thank you meywue, you are awesome! Just tried it and it works perfectly! Thank you very much! :oops::)
     
  4. MysteryManGER

    MysteryManGER
    Expand Collapse

    Joined:
    May 25, 2016
    Messages:
    647
    Hey! Just another question regarding the gravity. We can use positive or negative gravity-settings...but would it be possible to have sideways gravity? Or a gravity around a center (like a planet where you can drive around without falling off?

    And what else is possible with the "BeamNG Trigger" except changing the gravity?

    Thanks in Advance! :)
     
    • Like Like x 1
  5. RyvyLo

    RyvyLo
    Expand Collapse

    Joined:
    May 15, 2014
    Messages:
    438
    I have no idea about sideway gravity, but I know that gravity around a center isn't possible because it would require to expand the complexity of the gravity calculations and it would be too computer intensive to be reasonable for a feature that wouldn't be used often.

    And with the BeamNGTrigger, you can call any piece of lua code so really you can do a lot (changing to a cinematic camera like in gridmap or the senseless destruction scenarios, triggering sound effects, teleporting and spawning vehicles or any static mesh really, showing a text message, etc... with some creativity almost everything is possible, you can take a look in the BeamNG/lua directory to see everything that runs on lua in BeamNG)
     
    • Agree Agree x 1
    • Informative Informative x 1
  6. meywue

    meywue
    Expand Collapse
    Administrator
    BeamNG Team

    Joined:
    Nov 19, 2015
    Messages:
    339
    As @RyvyLo already mentioned, there is no sideways gravity etc. Also this kind of planetary gravity is unfortunately not there as well. You may need to hack something together :D

    Furthermore there is a wiki page which contains some of the lua functions. It's far from being complete but we're working on it to add more and more to it.
     
  7. Taza

    Taza
    Expand Collapse

    Joined:
    Nov 8, 2015
    Messages:
    1,335
    Just an idea: could you possibly make "sideways" gravity with wind? It's not exactly the same but I guess that could work?
     
    • Agree Agree x 1
  8. MysteryManGER

    MysteryManGER
    Expand Collapse

    Joined:
    May 25, 2016
    Messages:
    647
    If wind could be used just inside a trigger zone...maybe... have to try it.

    @RyvyLo & @meywue: Thanks, must have a look at it if I have a lot of time. Never used lua codes before... don't know how to configure them correctly at the moment. It's a completely new topic for me ;)

    But awesome support guys! THANKS! :D
     
    • Agree Agree x 1
  9. meywue

    meywue
    Expand Collapse
    Administrator
    BeamNG Team

    Joined:
    Nov 19, 2015
    Messages:
    339
    Actually thought of wind as well but haven't had the guts to mention it since it's the super-hacky way of doing it! :D
     
    • Like Like x 1
  10. MysteryManGER

    MysteryManGER
    Expand Collapse

    Joined:
    May 25, 2016
    Messages:
    647
    It does not work anymore with the LUA trigger. Any ideas?
     
  11. SARUMAN

    SARUMAN
    Expand Collapse

    Joined:
    May 16, 2019
    Messages:
    20
    Nope, G force is a global setting. But I am still looking for a mode to add a new preset like MicroGrav. (0.05) such as an asteroid or MacroG. like a Black Hole.
     
  12. GotNoSable!

    GotNoSable!
    Expand Collapse
    Banned

    Joined:
    Jan 10, 2019
    Messages:
    812
    This got answered a hella-long time ago buddy.
     
  13. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    There was actually planets gravity added to some updates ago, but I forgot the code how to use it, it could be relevant to ancient question though as now there is all those new possibilities available.
     
  14. SARUMAN

    SARUMAN
    Expand Collapse

    Joined:
    May 16, 2019
    Messages:
    20
    A command line will be enough to update the options.
     
  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