void Start() { openCVGestureDetection = GetComponent <OpenCVGestureDetection>(); screen.transform.localScale = new Vector3(openCVGestureDetection.GetCamWidth() / 10, 1, openCVGestureDetection.GetCamHeight() / 10); Vector3 scale = screen.transform.localScale; screen.transform.position = new Vector3((scale[0] / 2) * 10, -(scale[2] / 2) * 10, 0); psEffect.Stop(); //player playerHand = Instantiate(handPrefab, new Vector3(0, 0, 0), Quaternion.identity); playerHand.name = "PlayerHand"; playerHand.transform.eulerAngles = new Vector3(-180, 270, 90); playerHand.transform.position = new Vector3(screen.transform.position.x - 100, screen.transform.position.y, 0);; playerAnimator = playerHand.transform.Find("Armature").GetComponent <Animator>(); playAnimation(playerAnimator, "Scissors"); //IA opponentHand = Instantiate(handPrefab, new Vector3(0, 0, 0), Quaternion.identity); opponentHand.name = "IAHand"; opponentHand.transform.eulerAngles = new Vector3(-180, 270, 90); opponentHand.transform.position = new Vector3(screen.transform.position.x + 100, screen.transform.position.y, 0); opponentHand.transform.Find("Mesh").GetComponent <Renderer>().material = opponentMat; opponentAnimator = opponentHand.transform.Find("Armature").GetComponent <Animator>(); playAnimation(opponentAnimator, "Paper"); Debug.Log("Scale: " + screen.transform.localScale.x + "," + screen.transform.localScale.z); UIText.text = ""; psEffect.transform.parent = cam.transform; psEffect.transform.localPosition = new Vector3(0, 0, 30); }
void Start() { openCVGestureDetection = GetComponent <OpenCVGestureDetection>(); screen.transform.localScale = new Vector3(openCVGestureDetection.GetCamWidth() / 10, 1, openCVGestureDetection.GetCamHeight() / 10); Vector3 scale = screen.transform.localScale; screen.transform.position = new Vector3((scale[0] / 2) * 10, -(scale[2] / 2) * 10, 0); screenRenderer = screen.GetComponent <Renderer>(); drawingTexture = new Texture2D(resolution, resolution); drawingTexture.Apply(); screenRenderer.material.mainTexture = drawingTexture; //camera camHeight = openCVGestureDetection.GetCamHeight(); camWidth = openCVGestureDetection.GetCamWidth(); //brush setBrushColor(brushColor); Debug.Log("Scale: " + screen.transform.localScale.x + "," + screen.transform.localScale.z); }