PhotoNetwork.Instantiate();
Hello,
I am using PhotonNetwork to Instantiate a GameObject when the mouse button is clicked. I have set the position to the end of the barrel of the gun. When i click to instantiate the object it gets spawned but it is always at the origin of the map 0,0,0. I am not sure why this is happening as i am getting the transform of the gun barrel end when the mouse is clicked. Not sure if i am going about this the correct way.
Any help for a newbie would be great.
Many thanks
Daniel
I am using PhotonNetwork to Instantiate a GameObject when the mouse button is clicked. I have set the position to the end of the barrel of the gun. When i click to instantiate the object it gets spawned but it is always at the origin of the map 0,0,0. I am not sure why this is happening as i am getting the transform of the gun barrel end when the mouse is clicked. Not sure if i am going about this the correct way.
if (Input.GetMouseButtonDown(0))
{
var _spawnPoint = GameObject.Find("SpawnPoint");
GameObject missile = PhotonNetwork.Instantiate("Bullet", transform.position, transform.rotation, 0);
missile.GetComponent<Rigidbody>().AddForce(Vector3.forward * 500);
}
Any help for a newbie would be great.
Many thanks
Daniel
0
Comments
-
RESOLVED
0 -
RESOLVED.
0 -
how did you resolve it???0