コード例 #1
0
ファイル: P3D_Paintable.cs プロジェクト: radiomonter/Tanki_X
    public static void ScenePaintPerpedicularNearest(P3D_Brush brush, Vector3 position, float maxDistance, int layerMask = -1, int groupMask = -1)
    {
        P3D_Paintable paintable = null;
        P3D_Result    result    = null;

        for (int i = AllPaintables.Count - 1; i >= 0; i--)
        {
            P3D_Paintable paintable2 = AllPaintables[i];
            if (P3D_Helper.IndexInMask(paintable2.gameObject.layer, layerMask))
            {
                P3D_Tree tree = paintable2.GetTree();
                if (tree != null)
                {
                    Transform transform = paintable2.transform;
                    if (P3D_Helper.GetUniformScale(transform) != 0f)
                    {
                        P3D_Result result2 = tree.FindPerpendicularNearest(transform.InverseTransformPoint(position), maxDistance);
                        if (result2 != null)
                        {
                            paintable    = paintable2;
                            result       = result2;
                            maxDistance *= result2.Distance01;
                        }
                    }
                }
            }
        }
        if (paintable != null)
        {
            paintable.Paint(brush, result, groupMask);
        }
    }
コード例 #2
0
    // This paints the nearest triangle perpendicular to the input position
    // NOTE: This method requires you to call SetMesh first
    public void PaintPerpendicularNearest(Vector3 position, float maxDistance, P3D_CoordType coord = P3D_CoordType.UV1)
    {
        if (CanMeshPaint == true)
        {
            position = transform.InverseTransformPoint(position);

            Paint(tree.FindPerpendicularNearest(position, maxDistance), coord);
        }
    }
コード例 #3
0
ファイル: P3D_Paintable.cs プロジェクト: q453157180/P3D
    // This will paint all surfaces perpendicular to the position within maxDistance in world space
    public void PaintPerpendicularNearest(P3D_Brush brush, Vector3 position, float maxDistance, int groupMask = -1)
    {
        if (CheckTree() == true)
        {
            var uniformScale = P3D_Helper.GetUniformScale(transform);

            if (uniformScale != 0.0f)
            {
                var point   = transform.InverseTransformPoint(position);
                var results = tree.FindPerpendicularNearest(point, maxDistance / uniformScale);

                Paint(brush, results, groupMask);
            }
        }
    }