Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

How can I get bullets to change direction when using Photon.Instantiate()?

$
0
0
Here's the code thats giving me trouble: Gameobject clone = (Gameobject)PhotonNetwork.Instantiate("projectile", transform.position, transform.rotation); clone.rigidbody.velocity = Vector3.forward * projectilespeed; This bit of code is attached to an empty gameobject called "hand". The character is structured like this: Character>Main Camera> Hand. When I spawn a projectile, it does not face my current rotation.For example, I will turn my character to the left or right, but the bullets always travel along the z- axis. They should follow my rotation, like bullets coming out of the barrel of the gun that I am holding. I don't know what I am doing wrong. Can someone please assist me with this issue? Thank you.

Viewing all articles
Browse latest Browse all 7934

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>