This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials
In this example you can easily get an set an objects center by executing a script like so ...
select action part > action, script > execute a script > setObjCent("scene_name", "object_name", object center value)
setObjCent("Scene_001", "Rock", 750)something to take into consideration is that the new object center will not take effect until the scene has been reloaded. in the actions tab I have included a center screen to current character before executing the script & end center screen to current character after reloading the current scene - I have done this because otherwise it automatically centers screen to character after screen reload & looks messy when it makes the screen jump to another position.
I have also hidden the mouse cursor before & after executing the script to prevent the user from clicking/walking anywhere else while the script is being executed ... this is more of a preference thing as is centering the screen.
instructions for the demo: left click on the rock to set the rock so that it is in front of the character ... right click on the the rock to set the object center to 0 & push the rock behind the user.
it takes 1 second for the screen to refresh. (reason is because I needed it to center screen on character first - set pause to whatever you like)
the current object center is printed to the log file before executing the set object part of the script & then the new object center is printed to the log file after executing the script - you could of course --comment out most of the script if you don't want it to print anything to the log.
simple version without print log messages
-- * let's set the new object center value! * --
function setObjCent(scnName, scnObj, val)
getObject('Scenes[' .. scnName .. '].SceneObjects[' .. scnObj .. ']'):setValue(VObjectCenter, val)
end
--[[ variable get & set object center example
example: setObjCent("scene_001", "Rock", 750) --]]-- * let's get the object center value * --
function getObjCent(scnName, scnObj)
getCent = getObject('Scenes[' .. scnName .. '].SceneObjects[' .. scnObj .. ']'):getInt(VObjectCenter)
end
-- * let's set the new object center value & check if it's correct afterwards! * --
function setObjCent(scnName, scnObj, val)
getObjCent(scnName, scnObj) -- get the current object center value of the linked object!
print('Current value of ' .. scnObj .. ' is ' .. getCent ..'!') -- print the current object center value!
--*--
getObject('Scenes[' .. scnName .. '].SceneObjects[' .. scnObj .. ']'):setValue(VObjectCenter, val) -- set the new object center value!
--*--
getObjCent(scnName, scnObj) -- get the new object center value of the linked object!
print('New value of ' .. scnObj .. ' is ' .. getCent .. '!') -- print the new object center value!
end
The free version covers up to 25 scenes per project. For more scenes and to sell your game, you need a license. Until 1 Dec 2026 all licenses are 30 % off, for example the Indie Bundle for €69.30 instead of €99. The code BLACKFRIDAY is applied automatically at checkout.
See licenses Try it for freeThis thread is closed because nobody has replied for more than a year. Feel free to ask your question in a new thread.
New threadDeponia, The Whispered World and more than 160 other games were made with Visionaire Studio. The free version covers up to 25 scenes. For more scenes there is Visionaire Studio PRO from €75, and to sell your game the Indie Bundle for €99.
Through December 1: all licenses 30% off, for example the Indie Bundle for €69.30 instead of €99. Applied automatically at checkout.