#share the error and the code

1 messages · Page 1 of 1 (latest)

crystal compass
#

Sup

#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Shooting : MonoBehaviour
{
private Camera mainCam;
private Vector3 mousePos;
// Start is called before the first frame update
void Start()
{
mainCam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>();
}

// Update is called once per frame
void Update()
{
    mousePos = mainCam.ScreenToViewportPoint(Input.mousePosition);

    Vector3 rotation = mousePos - transform.position;

    float rotZ = Mathf.Atan2(rotation.y, rotation.x); * Mathf.Rad2Deg;

    transform.rotation = Quaternion.Euler(0, 0, rotZ);
}

}

#

Code

#

CS0193

#

and CS0201

strange wadi
#

and in what line is the error ?

crystal compass
#

line 22

strange wadi
#

my gues is here ?
float rotZ = Mathf.Atan2(rotation.y, rotation.x); * Mathf.Rad2Deg;

crystal compass
#

yeah

#

its the * mathf......

strange wadi
#

there is a ; to many

crystal compass
#

gimme sec

#

pls

strange wadi
#

; ends the statment and so there should only be one in that line

crystal compass
#

LOL..... idk how but thxx... still doesnt work like its suppost to but no more error

crystal compass
#

exact

#

thx

crystal compass
#

yo @strange wadi .... i need ur help 1 more time

#

if you are willing to help

strange wadi
crystal compass
#

can yo come in a call? (you can mute ur mic)