Blockland Forums > Modification Help

Bricks Adjacent To a Brick

Pages: (1/2) > >>

Pink Ranger:

Is there a way to identify a brick that's touching another brick without using raycasting? Similar to the getDownBrick() function?

otto-san:

as far as I know, no, not unless it's above or below the brick.

Ipquarx:

In order to do that, you'd have to loop through all the bricks and check if their position relative to their width/length and to the target bricks positions match up.

like if the bricks position +(or -) their length(or width) is 1 +(or -) the target bricks x(or y) position.

otto-san:


--- Quote from: Ipquarx on November 23, 2011, 01:24:33 PM ---In order to do that, you'd have to loop through all the bricks and check if their position relative to their width/length and to the target bricks positions match up.

like if the bricks position +(or -) their length(or width) is 1 +(or -) the target bricks x(or y) position.

--- End quote ---
So it'd be really tedious and inefficient to do it any other way than a raycast by the looks.

M:

Use a box search (look in the Containers and Raycasts section of the reference PDF posted here) using the size of the brick. Relevant things assuming %brick is the brick you want to get the surrounding bricks of:

--- Code: ---%brick.getWorldBoxCenter()
%brick.getDatablock().brickSizeX
%brick.getDatablock().brickSizeY
%brick.getDatablock().brickSizeZ
--- End code ---
Note that the brickSize fields on the datablock are in BLB units, not Torque units; the conversion is that one cubic Torque unit is 2x2x5 BLB units (so halve X and Y, divide Z by 5 - then add 0.1 or so to expand the box outside the size of the brick's bounding box)

Have fun working it out! (You will benefit more from this than being given code)

Pages: (1/2) > >>

Go to full version