Search Unity

Change the rotation of the object on the z-axis according to the mouse position in 2d game

Discussion in 'Scripting' started by sabahief97, Jul 16, 2019.

  1. sabahief97

    sabahief97

    Joined:
    Jul 2, 2019
    Posts:
    1
    Merhaba arkadaşlar Her şeyden önce, kötü İngilizcem için üzgünüm. Fare pozisyonuna göre topu z ekseni istiyorum. Bunu yaptım.Ama alt satırdan döndürmek istemiyorum. Bunu nasıl yapabilirim. Lütfen bana yardım et !!
    a1.PNG

    [code = CSharp] void YonCevir ()
    {
    if (Input.GetMouseButton (0))
    {
    Vector3 mousePos = Input.mousePosition;
    mousePos = Camera.main.ScreenToWorldPoint (mousePos);
    Vektör2'de = yeni Vektör2 (mousePos.x - transform.position.x, mousePos.y - transform.position.y);


    transform.up = yön;

    }
    } [/ Kod]