Block Generator
by Jonas · in Torque 3D Beginner · 08/23/2010 (9:32 pm) · 1 replies
Hi Community!
Today i have a rather interesting question:
Lets say i wanna generate a bunch of blocks (about 40000) that are right next to each other with a set size lets say 20x20(every block is exactly the same size and just a box 6 sides) how would one do that?
and for the sake of argument lets say i want the "block build" to be 20 blocks deep and the height should follow a height map.
Is this something torque3d would be able to do with relative ez? (aka with script and no source code changes)
NOTE: if you got a solution to this feel free to post it but its more of a "how should i go about doing this" question.
Thanks
Melander
Today i have a rather interesting question:
Lets say i wanna generate a bunch of blocks (about 40000) that are right next to each other with a set size lets say 20x20(every block is exactly the same size and just a box 6 sides) how would one do that?
and for the sake of argument lets say i want the "block build" to be 20 blocks deep and the height should follow a height map.
Is this something torque3d would be able to do with relative ez? (aka with script and no source code changes)
NOTE: if you got a solution to this feel free to post it but its more of a "how should i go about doing this" question.
Thanks
Melander
About the author
Freelance 3D artist at day scripter/coder on Enduring Life at night. Lover of all things TorqueScript.
Torque Owner Jonathan Noyola
Fisticuff Games
%xStart = 0; %yStart = 0; %columns = 20; %rows = 20; %xSpacing = 10; %ySpacing = 10; %xSize = 20; %ySize = 20; %zSize = 20; for (%c = 0; %c < %columns; %c++) { for (%r = 0; %rows < 20; %r++) { %x = %xStart + (%c * (%xSpacing + %xSize)); %y = %yStart + (%r * (%ySpacing + %ySize)); %z = getTerrainHeight(%x SPC %y) + 170; //<-You might need to add something to %z, for Empty Terrain I found you need to add about 170. You can also change this number if you want the boxes floating or deeper into the ground. new TSStatic ("Block_" @ %c @ "_" @ %r) { shapeName = "art/shapes/box.dts"; // Change this position = %x SPC %y SPC %z; scale = %xSize SPC %ySize SPC %zSize; // If the box's size is already what you want, then you don't need this line // Other stuff that you may or may not need playAmbient = "1"; receiveSunLight = "1"; receiveLMLighting = "1"; useCustomAmbientLighting = "0"; customAmbientLighting = "0 0 0 1"; collisionType = "Visible Mesh"; allowPlayerStep = "0"; renderNormals = "0"; canSaveDynamicFields = "1"; }; } }