Question by
GameMaker1111 · Feb 06 at 06:09 PM ·
c#rotationrigidbody2dnpc
Make Prefab Rotate Depending on a different Game Object's Rotation.
I have bullets that are Instantiated based on a other game objects postion but I would also like it to rotate depdening on that game object's rotation aswell.
I have two scripts one that manipualtes the movement of the bullet and another script where the bullets is Instantiated.
Movement code for bullet: bulletRigid.velocity = new Vector2(transform.position.x, transform.position.y);
Code to instantiate bullets: Vector3 position = new Vector3(farRangeNPC.transform.position.x, farRangeNPC.transform.position.y, farRangeNPC.transform.position.z); var bullets = MonoBehaviour.Instantiate(prefab, position, Quaternion.identity);
Comment