Tabletop Simulator

Tabletop Simulator

Not enough ratings
Fun with Grids and Physics
   
Award
Favorite
Favorited
Unfavorite
Number of Players: 1, 2, 3, 4
Assets: Scripting
Tags: 4+
File Size
Posted
Updated
35.492 KB
Apr 24, 2016 @ 1:21am
Apr 26, 2016 @ 5:37pm
5 Change Notes ( view )

Subscribe to download
Fun with Grids and Physics

Description
This is sample code from me experimenting in the TTS engine...
Basically this creates grids, or grids of grids, of adjustable dimensions of game blocks (could be anything loadable in code easy enough)

Attaches to each object a piece of code that makes them function like a mouse trap. Each object can trigger once on a collision. It will send itself and whatever hit it, flying upwards.

Includes:
spawning objects in the world
placing objects in a grid
spacing objects apart in a grid
attaching lua scripting to an object
making events fire only once
applying force to an object
applying force to a colliding object

At the top of the code are the following settings, play with them and see what different effects you get.

baseEnabled = false -- do you want to spawn the giant grey ground plane?
blocksEnabled = false -- do you want to spawn blocks?

numGridsX = 1 -- how many grids to use left/right
numGridsZ = 1 -- how many grids to use up/down

gridWidth = 5 -- width of block grid
gridHeight = 5 -- height of block grid

--default square blocks are 1x1 unit in game
blockSizeX = 3 -- block width (left/right)
blockSizeY = 2 -- block height (up)
blockSizeZ = 3 -- block depth (forward/backward)

blockSpacing = 0.1 -- how much space between each block
blockSpacingScaled = false -- do we want this to scale with the block dimensions?
2 Comments
victorhurtado Mar 18, 2021 @ 11:40am 
H3xx idea would have been bomb! :(
H3xx Jul 14, 2016 @ 11:55pm 
Since you're experimenting, Perhaps you could make a tool that allows you to put a model inside a bag or infinte bag, and then place two markers and have it fill a square between the two markers using copies of the piece in the bag? Kind of like the magic wand mod from Minecraft? It would make dungeon building so much easier and quicker...