Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

object ref

Discussion in 'Scripting' started by keepthachange, Aug 14, 2016.

  1. keepthachange

    keepthachange

    Joined:
    Oct 15, 2014
    Posts:
    87
    egnsgdnef
     
    Last edited: Aug 16, 2016
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    Code (csharp):
    1.  
    2.  LastFiredProjectile3.transform.rotation=gameObject.transform.rotation;
    3. GameObject.Instantiate(ProjectileObject3,spawnPos3,gameObject.transform.rotation)
    4.  
    both these lines are taking the rotation of the gameobject this script is attached to, if you want it to use another gameobject's rotation you'll need to specify it

    i.e.
    Code (csharp):
    1.  
    2. otherGameObject.transform.rotation; // or whatever the reference is called
    3.