Ejemplo n.º 1
0
    //Used to update the rotation of the firepoint to look at the current mouse position in world space
    public void UpdateFirePointRotation()
    {
        Vector2 mousePos = mainCamera.ScreenToWorldPoint(Input.mousePosition);
        //print("mouse position (world): " + mousePos);
        float angle = UsefulMethods.FindAngleBetweenPositions2D(this.transform.position, mousePos);

        //print("angle: " + angle);
        transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
    }