Move objects with LUA

Discussion in 'Programming' started by Masuo, Sep 3, 2021.

  1. Masuo

    Masuo
    Expand Collapse

    Joined:
    Aug 25, 2020
    Messages:
    33
    Hi, is there any way to move static nodes or TSStatics or anything that has collision using lua scripts? I've read some documentation and wiki but found nothing.
     
  2. angelo234

    angelo234
    Expand Collapse
    Programmer
    BeamNG Team

    Joined:
    Aug 11, 2017
    Messages:
    539
    This should work (replace "name of object" with the "name" field value of the object and replace x, y, z with actual coordinates):
    Code:
    local object = scenetree.findObject("name of object")
    
    local pos = Point3F(x, y, z)
    object:setPosition(pos)
    
    be:reloadStaticCollision(false)

    What I mean by "name" field:
    example.png
     
    • Like Like x 1
  3. Masuo

    Masuo
    Expand Collapse

    Joined:
    Aug 25, 2020
    Messages:
    33
    thanks!
     
  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