#share the error and the code
1 messages · Page 1 of 1 (latest)
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
and in what line is the error ?
line 22
my gues is here ?
float rotZ = Mathf.Atan2(rotation.y, rotation.x); * Mathf.Rad2Deg;
there is a ; to many
; ends the statment and so there should only be one in that line
LOL..... idk how but thxx... still doesnt work like its suppost to but no more error
one step closer 🙂
sure whats up
can yo come in a call? (you can mute ur mic)