Blockland Forums > Modification Help
Spawn brick aligned to grid help
MARBLE MAN:
Im trying to make a generator for "Terrain Like" formations...
Ive looked at countless codes for teh answer...
I know:
--- Code: --- %brick = new fxDTSBrick()
{
datablock = brick4xCubeData;
position = vectorAdd(%pos,"0 0 -1.0");
isPlanted = 1;
colorID = %obj.client.currentColor;
};
if(!isObject(BrickGroup_10103))
{
new SimGroup(BrickGroup_10103)
{
bl_id = 10103;
name = "MARBLE MAN";
};
MainBrickGroup.add(BrickGroup_10103);
}
--- End code ---
I want to know how to spawn it in a radius aligned to a grid.....
Terragen code doesnt help me much...
Please help!
Brian Smithers:
look at my terrain generator.
let me explain how these work anyway...
so you got your position
%pos
and you want to have to allign to a 4xCube Brick. Since positions go from the center, you have to use 2, since theres 2 studs from the center of a 4xCube.
Then it's just a bit of math. Basically you multiply it by two then divide it by two. Then since you round it. i still dont know why.
%x = getWord(%pos,0);
%y = getWord(%pos,1);
%z = getWord9%pos,2);
%x = mFloatLength((%x * 2) / 2,0);
%y = mFloatLength((%y * 2) / 2,0);
%z = mFloatLength((%z * 2) / 2,0);
%pos = %x SPC %y SPC %z;
MARBLE MAN:
--- Quote from: Brian Smithers on April 06, 2012, 11:41:39 PM ---look at my terrain generator.
--- End quote ---
Where?
Nexus:
do you want it to be a perfect circle around the player or is a box/diamond okay?
Treynolds416:
Bricks automatically align themselves to the brickgrid. If I told torque to plant a 4x cube at "440.564 525.64 467.367", a new 4x cube would appear at "440.5 525.5 467.4"