Quantcast
Channel: Recent Discussions — Photon Engine
Viewing all articles
Browse latest Browse all 15755

Top Down Shooter Rotation Problem

$
0
0
I'm Trying to make a Top Down Shooter Game and make the Player Rotate Towards the Mouse using this Code

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 :)

Viewing all articles
Browse latest Browse all 15755

Latest Images

Trending Articles



Latest Images