Author Topic: Checking if a position is at the center of a brick  (Read 484 times)

Title pretty much explains it

Can someone write up a quick function that returns 1 if the given position is at the center of an existing brick, and 0 if it is not.

Code: [Select]
function isCenterOfBrick(%brick,%pos)
{
if(%brick.position $= %pos)
return 1;
return 0;
}

No, like %pos is the only input

Edit: pseudocode looks like this:
Code: [Select]
function isBrickCenter(%pos)
{
    %brick = whatBrickIsItIn(%pos);
    if(%brick == -1)
        return -1;
    if(%pos $= %brick.position)
        return 1;
    return 0;
}
« Last Edit: March 25, 2012, 12:22:56 PM by Treynolds416 »

%brick.getWorldBoxCenter(); i think works?

Do a container radius search with something such as 0.1 for $TypeMasks::fxBrickObjectType and check the position of each found object.

That's what I thought was involved. I actually do not know how to do that, so would someone be as kind as to type up one here or link me to a good example?