Top Down Shooter Rotation Problem
Options
I'm Trying to make a Top Down Shooter Game and make the Player Rotate Towards the Mouse using this Code
but the Problem is the both Players are rotating from one player Input
and Yes I Disabled the Player Script on the Player Prefab and Enable It when the Player Spawns
but It still doesn't work
can you please Help
if(CAM != null)
{
Ray ray = CAM.ScreenPointToRay(Input.mousePosition);
RaycastHit Hit;
if(Physics.Raycast(ray,out Hit,1000))
{
MouseTarget = Hit.point;
}
Vector3 direction = MouseTarget - transform.position;
direction.y = 0;
this.transform.LookAt(transform.position + direction,Vector3.up);
}
but the Problem is the both Players are rotating from one player Input
and Yes I Disabled the Player Script on the Player Prefab and Enable It when the Player Spawns
GameObject myPlayer = (GameObject)PhotonNetwork.Instantiate(player,spawns[Random.Range(0,spawns.Length)].transform.position,Quaternion.identity,0);
myPlayer.gameObject.GetComponent<Player>().enabled = true;
but It still doesn't work
can you please Help
0