예제 #1
0
    // Snapping dynamics:

    // snaps the height if necessary
    // @return: did a snap actually occur?
    bool SnapHeight(Transform t)
    {
        IntegerVector3 index = BlockArea.WorldSpaceToIndex(t.position);

        if (BlockArea.IsOccupied(index, cubePositions, t.rotation, id))
        {
            do
            {
                index.y++;
            } while (BlockArea.IsOccupied(index, cubePositions, t.rotation, id));

            t.SetPositionAndRotation(BlockArea.IndexToWorldSpace(index), t.rotation);

            return(true);
        }
        return(false);
    }