FeMaiden wrote:I did notice, when I try to place a torch holder on a ruins wall, it clips though the wall and only shows halfway.
how would I fix that with scripts?
The scripting reference lists commands for repositioning objects either snapped to the tile grid, or positioned manually on the map. For this one usually wants the manual positioning: setWorldPosition() and/or setWorldPositionY() ~Y means up/down on the map.
If an object is just a bit too low on the ground, then object:setWorldPositionY(0.1) will raise it .1 units upward.
If an object needs to be moved to the side, then object:setWorldPosition(vec(x,y,z)) can reposition it to x,y,z; these are float/decimal numbers.
The easiest way (I know of) to see the base starting position of the object is to use print(object:getPosition()) in the console.
The max units moved up or down, should probably be the module height when moving interactive (clickable) objects; [which is usually 3 or 4]. For side to side movement, the tiles are each 3x3 units wide; after that it's in another tile.
What I use is a 'touch-up' script that adds offsets. While making the map, if I find clipping issues or other cases where I need to affect a change in an object's position, I put them in the script and they run when the game loads the map.
For example, by default, placing a mine_door_spear gate on the edge of a forest chasm edge, results in bad clipping with the rocky edges of the chasm.
To fix this I would adjust the position of the mine door, and/or anything near it that needs moved to make room.
This [below] is what I used for these screenshots, but you can [of course] just type the standard command as seen in the scripting reference.
(I just fill the table with whatever changes I need for any object.)
Code: Select all
-- touch_ups
do
local objects = { "mine_door_spear_1", 'setWorldPosition',vec(50.65,0,49.5),
"forest_bridge_end_2", 'setWorldPosition',vec(50.55,0,49.5),
}
for x = 1, #objects, 3 do
local entity = findEntity(objects[x])
local action = objects[x+1]
local offset = objects[x+2]
entity[action](entity, unpack(offset))
end
end