Author Topic: Plant a brick on top of another?  (Read 1194 times)

We have a project going on over at SS, but we aren't sure how to plant one brick on top of another. How is this done so that they are structurally connected?

EDIT: This is the current code: https://etherpad.mozilla.org/ep/pad/view/ro.0MRCP6Rc-iy/latest
« Last Edit: April 09, 2012, 12:46:15 PM by Greek2me »

Psuedocode:
Code: [Select]
function isSupported(%pos,%brickData)
{
    %bounds = %brickData.brickSize; //Would be a 3 component vector in this case, not sure what .brickSize actually returns
    //Check if there is another brick in the current space the new brick is about to occupy
    %minorBox = containerFindFirst($TypeMasks::Brick,%pos,getWord(%bounds,0) - 0.01,getWord(%bounds,1) - 0.01,getWord(%bounds,2) - 0.01);
    if(%minorBox != 0)
        return -1;
    //Now check if there is a brick directly above or below the space the new brick is about to occupy
    %majorBox = containerFindFirst($TypeMasks::Brick,%pos,getWord(%bounds,0),getWord(%bounds,1),getWord(%bounds,2) + 0.01);
    if(%majorBox != 0)
        return 1;
    return -1;
}

Based mostly on speculation, trying to write this from my iPhone without testing anything in BL