void DrawingContinue() { if (focus == null) { return; } // Use these facts about the brush in 3d to help orient paint swatches Vector3 xyz = brush.transform.position; Vector3 right = brush.transform.right; Vector3 forward = brush.transform.forward; /* // A mode where the brush 3d position is ignored * if(ignoreFingerPosition == true) { * input.z = 400; * xyz = Camera.main.ScreenToWorldPoint(input); * xyz = world.transform.InverseTransformPoint(xyz); * } */ Swatch3d art = focus.GetComponent <Swatch3d>() as Swatch3d; art.paintConsider(xyz, right, forward, DrawSizeDefault); //AddDots(); }
void HandleDown(Vector3 input) { // check for 3d in world button events if (HandleButtons(input)) { return; } // ignore finger position if you are painting in the right corner if ((input.x > Screen.width - 100) && (input.y < 100)) { brush.gameObject.SetActive(true); brush.position = target.position; ignoreFingerPosition = true; } else { brush.gameObject.SetActive(true); ignoreFingerPosition = false; } // start new art focus = Instantiate(prefabSwatch) as GameObject; focus.transform.parent = this.transform; Swatch3d art = focus.GetComponent <Swatch3d>() as Swatch3d; art.setup(color, style, material); HandleMove(input); }
void DrawingEnd() { if (focus == null) { return; } Swatch3d art = focus.GetComponent <Swatch3d>() as Swatch3d; focus = null; if (art.paintFinish() == false) { Destroy(art); } }
void HandleUp() { brush.gameObject.SetActive(false); Debug.Log("Finished " + focus); if (focus == null) { return; } Swatch3d art = focus.GetComponent <Swatch3d>() as Swatch3d; focus = null; if (art.paintFinish() == false) { Destroy(art); } }
void test() { focus = Instantiate(prefabSwatch) as GameObject; focus.transform.parent = this.transform; Swatch3d art = focus.GetComponent <Swatch3d>() as Swatch3d; art.setup(color, Swatch3d.STYLE.TUBE, material); Vector3 xyz = brush.transform.position; Vector3 right = brush.transform.right; Vector3 forward = brush.transform.forward; art.test(right, forward, DrawSizeDefault); focus = null; }
void DrawingBegin() { /* * // Support a special mode for painting in 3d rather than with screen as an aid * if( (input.x > Screen.width - 100) && (input.y < 100)) { * ignoreFingerPosition = true; * } else { * ignoreFingerPosition = false; * } */ // start new art swatch focus = Instantiate(prefabSwatch) as GameObject; focus.transform.parent = gameObject.transform; Swatch3d art = focus.GetComponent <Swatch3d>() as Swatch3d; art.setup(color, style, material); lastObject = null; }
void HandleMove(Vector3 input) { if (focus == null) { return; } Swatch3d art = focus.GetComponent <Swatch3d>() as Swatch3d; Vector3 xyz = brush.transform.position; Vector3 right = brush.transform.right; Vector3 forward = brush.transform.forward; if (ignoreFingerPosition == false) { // If the user is moving their finger around then use that as a draw hint input.z = 400; // xxx TODO hack use the estimated starting distance- should correct this xyz = brush.position = Camera.main.ScreenToWorldPoint(input); } art.paintConsider(Camera.main.transform.position, xyz, right, forward, DrawSizeDefault); }