1. Stuck, Having problems with creating your mod? Let us help you: Mod Support

Solved [LUA] GE, get position of an TSStatic

Discussion in 'Mod Support' started by thomatoes50, Dec 1, 2016.

  1. thomatoes50

    thomatoes50
    Expand Collapse
    Staff Member

    Joined:
    Jan 31, 2013
    Messages:
    604
    I want to get the position of a TSStatic to modify it.
    • Can the value be modified from LUA
    • How can i access it?
    My progress so far
    Code:
    o = scenetree.findObject("test1")
    pos = o.get(o,"position")
    I have trouble with pos because it's an userdata of type const_class<MatrixF>
     
  2. tdev

    tdev
    Expand Collapse
    Developer
    Staff Member

    Joined:
    Aug 3, 2012
    Messages:
    2,828
    this should work:
    Code:
    local o = scenetree.findObject("test1")
    if o then
      print(o:getPosition())
    end
    
     
  3. thomatoes50

    thomatoes50
    Expand Collapse
    Staff Member

    Joined:
    Jan 31, 2013
    Messages:
    604
    Thank you very much

    Code:
    pos = o:getPosition()
    
    pos['x'] = 2 + pos['x']
    
    o:setPosition(pos)
     
  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