Advertisement
AFRLme

Variable Get & Set ObjectCenter [VS]

Jan 21st, 2013
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.95 KB | None | 0 0
  1. --[[ variable get & set object center example
  2. example: setObjCent("scene_001", "Rock", 750) --]]
  3.  
  4. -- * let's get the object center value * --
  5. function getObjCent(scnName, scnObj)
  6.  getCent = getObject('Scenes[' .. scnName .. '].SceneObjects[' .. scnObj .. ']'):getInt(VObjectCenter)
  7. end
  8.  
  9. -- * let's set the new object center value & check if it's correct afterwards! * --
  10. function setObjCent(scnName, scnObj, val)
  11.  getObjCent(scnName, scnObj) -- get the current object center value of the linked object!
  12.  print('Current value of ' .. scnObj .. ' is ' .. getCent ..'!') -- print the current object center value!
  13.  --*--
  14.   getObject('Scenes[' .. scnName .. '].SceneObjects[' .. scnObj .. ']'):setValue(VObjectCenter, val) -- set the new object center value!
  15.  --*--
  16.  getObjCent(scnName, scnObj) -- get the new object center value of the linked object!
  17.  print('New value of ' .. scnObj .. ' is ' .. getCent .. '!') -- print the new object center value!
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement