Tabletop Simulator

Tabletop Simulator

View Stats:
Dr_East Aug 28, 2017 @ 4:28am
Flipping locked objects in place?
Hey all,

I've developed a (still work in progress) method of simulating fog-of-war as players explore a D&D dungeon. It would be a huge time-saver if I could flip a bunch of locked custom tiles to reveal the dungeon features on the reverse side as they're uncovered by the players. I know how to select a bunch of locked tiles (alt-mouse drag), but currently in order to do this I have to do the following steps through the right-click menu:

1. Shrink the tiles twice (to reduce the collision box)
2. Unlock them
3. Flip them.
4. Lock them.
5. Grow the tiles twice (while locked, collisions are ignored)

Is there any way I could a) flip them in place while they're still locked (thus negating the need for steps 1, 2, 4, and 5) or b) write some sort of script or macro to perform all these steps for me as a time saver?

Thanks!
< >
Showing 1-3 of 3 comments
Markimus Aug 28, 2017 @ 4:34am 
You could use the gizmo tool to edit its Z rotation to 0?

function onScriptingButtonDown(i, col) if col == "Black" and i == 3 then local pos = Player[col]:getPointerPosition() pos.y = pos.y + 1 local c = Physics.cast({origin=pos, direction={0, -1, 0}, type=1, debug=false}) local hit = c[1] if hit ~= nil and hit.hit_object ~= nil and hit.hit_object.tag ~= "Surface" then local obj = hit.hit_object local r = obj:getRotation() if r.z > 90 and r.z < 270 then obj:setRotation({x=0, y=r.y, z=0}) else obj:setRotation({x=0, y=r.y, z=180}) end end end end

I made some code for you. Plug this in the Global Script or wherever. This will let Player Black flip locked objects using the 3 on the NumPad.
Last edited by Markimus; Aug 28, 2017 @ 5:05am
Dr_East Aug 28, 2017 @ 5:46am 
Originally posted by Markimus:
You could use the gizmo tool to edit its Z rotation to 0?

function onScriptingButtonDown(i, col) if col == "Black" and i == 3 then local pos = Player[col]:getPointerPosition() pos.y = pos.y + 1 local c = Physics.cast({origin=pos, direction={0, -1, 0}, type=1, debug=false}) local hit = c[1] if hit ~= nil and hit.hit_object ~= nil and hit.hit_object.tag ~= "Surface" then local obj = hit.hit_object local r = obj:getRotation() if r.z > 90 and r.z < 270 then obj:setRotation({x=0, y=r.y, z=0}) else obj:setRotation({x=0, y=r.y, z=180}) end end end end

I made some code for you. Plug this in the Global Script or wherever. This will let Player Black flip locked objects using the 3 on the NumPad.


Thank you! I'd considered the gizmo tool, but that didn't save much time; this should be a huge timesaver.
Dr_East Aug 28, 2017 @ 9:14am 
All right, got it. This is the magic function that does what I want: Flips the token in place and then sets its position back exactly where it was. Tested and done. For anyone else who wants to put relevant dungeon info on the bottom of the tile and fog of war on top, this is the script for you!

...at least, until I can figure out how to do it on a selection of more than one object at once. Still working on that.

function onScriptingButtonDown(i, col) if col == "Black" and i == 3 then local pos = Player[col]:getPointerPosition() pos.y = pos.y + 1 local c = Physics.cast({origin=pos, direction={0, -1, 0}, type=1, debug=false}) local hit = c[1] if hit ~= nil and hit.hit_object ~= nil and hit.hit_object.tag ~= "Surface" then local obj = hit.hit_object local r = obj:getRotation() local r2 = obj:getPosition() local r3 = obj:getCustomObject() if r.z > 90 and r.z < 270 then obj:setRotation({x=0, y=r.y, z=0}) obj:setPosition({x=r2.x, y=r2.y - r3.thickness, z=r2.z}) else obj:setRotation({x=0, y=r.y, z=180}) obj:setPosition({x=r2.x, y=r2.y + r3.thickness, z=r2.z}) end end end end
Last edited by Dr_East; Aug 28, 2017 @ 9:42am
< >
Showing 1-3 of 3 comments
Per page: 1530 50

Date Posted: Aug 28, 2017 @ 4:28am
Posts: 3