Exemple #1
0
        CuttingTemplate GetTemplate()
        {
            CuttingTemplate template = CuttingTemplate.InLocalSpace(Vector3.up, Vector3.zero, transform).ToWorldSpace();

            Vector3 r = transform.forward * 0.08f,
                    f = transform.right * -0.2f,
                    p = transform.position;

            template.AddPoints(
                p + r - 5 * f,
                p + r + 1.2f * f
                );
            if (!pointy)
            {
                template.AddPoints(
                    p + 0.3f * r + 1.8f * f,
                    p - 0.3f * r + 1.8f * f
                    );
            }
            else
            {
                template.AddPoint(p + 1.8f * f);
            }
            template.AddPoints(
                p - r + 1.2f * f,
                p - r - 5 * f
                );

            return(template);
        }
Exemple #2
0
 void Update()
 {
     if (template == null)
     {
         return;
     }
     template.AddPoint(transform.TransformPoint(localCol), 0, 0.03f);
 }
Exemple #3
0
        public CuttingTemplate ToLocalSpace(Transform transform)
        {
            var t = new CuttingTemplate(
                transform.InverseTransformDirection(worldNormal),
                transform.InverseTransformPoint(world_pointInPlane),
                worldNormal,
                world_pointInPlane,
                isClosed
                );

            foreach (Vector3 p in points)
            {
                t.AddPoint(transform.InverseTransformPoint(p)); // tmp. p is assumed to be in world space
            }
            return(t);
        }