Blockland Forums > Modification Help
Checking if a position is at the center of a brick
Treynolds416:
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.
Chrono:
--- Code: ---function isCenterOfBrick(%brick,%pos)
{
if(%brick.position $= %pos)
return 1;
return 0;
}
--- End code ---
Treynolds416:
No, like %pos is the only input
Edit: pseudocode looks like this:
--- Code: ---function isBrickCenter(%pos)
{
%brick = whatBrickIsItIn(%pos);
if(%brick == -1)
return -1;
if(%pos $= %brick.position)
return 1;
return 0;
}
--- End code ---
Brian Smithers:
%brick.getWorldBoxCenter(); i think works?
Port:
Do a container radius search with something such as 0.1 for $TypeMasks::fxBrickObjectType and check the position of each found object.