Author Topic: Get the position of each stud on the top of a brick  (Read 638 times)

I need to get the (X,Y,Z) of each stud on the top of a brick, any ideas on accomplishing this as efficiently as possible?

Ignore this post. I'm incapable of thinking right now for some reason.
« Last Edit: February 07, 2014, 11:38:51 PM by $trinick »

"stud" as in where you can place a 1x1 on top? Does it have to work for special bricks too?

%box = %obj.getWorldBox();
%z = getWord(%box, 5);

%x1 = getWord(%box, 0) + 0.25;
%y1 = getWord(%box, 0) + 0.25;
%x2 = getWord(%box, 3) + 0.25;
%y2 = getWord(%box, 4) + 0.25;

for (%x = %x1; %x <= %x2; %x += 0.5)
{
   for (%y = %y1; %y <= %y2; %y += 0.5)
   {
      // %x %y %z
   }
}

%box = %obj.getWorldBox();
%z = getWord(%box, 5);

%x1 = getWord(%box, 0) + 0.25;
%y1 = getWord(%box, 0) + 0.25;
%x2 = getWord(%box, 3) + 0.25;
%y2 = getWord(%box, 4) + 0.25;

for (%x = %x1; %x <= %x2; %x += 0.5)
{
   for (%y = %y1; %y <= %y2; %y += 0.5)
   {
      // %x %y %z
   }
}

thanks port.