Question by
shadowpuppet · May 06, 2017 at 07:11 PM ·
instantiate prefabconflict
instantiated projectile conflicts
I throw grenades and it works fine, I have robots shooting rockets at me and that works fine. But if a robot has fired his rocket and I throw a grenade, my grenade takes on the properties of the robots rocket. I am confused. I am instantiating different prefabs and naming them differently. below are the two scripts. Also, if two robots are shooting their rockets do not effect each other, just my grenade
GameObject myGrenade = Instantiate(grenade, transform.position,Quaternion. identity)as GameObject;
myGrenade.GetComponent<Rigidbody>().AddForce (transform.forward *throwDistance);
GameObject robot2Missile = Instantiate(rob2rocket, MuzzleRobot2.position,Quaternion. identity)as GameObject;
robot2Missile.GetComponent<Rigidbody>().AddForce (transform.forward *throwDistance);
GameObject myRobotROcket = Instantiate(myRocket9, Muzzle.position,Quaternion. identity)as GameObject;
myRobotROcket.GetComponent<Rigidbody>().AddForce (transform.forward *throwDistance);
Comment