Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRanvir Sahota
9,844 PointsDon't understand the purpose of Quaternion.identity
I went through the tutorials thinking I might eventually understand why we have to use Quaternion.identity but my understanding has not improved. Why do we need to set the files/player particles instantiation to have no rotation? What would happen if we did add rotation to the files?
1 Answer
Garner Perigo
631 PointsHi!
My understanding is that the method "Instantiate" requires 3 arguments (object, position, rotation) and that the method does not provide default values for any of the arguments. So any time we use "Instantiate" in a script we must provide the values for all three of the arguments. "Quaternion.identity" is the "default" or none value to the objects rotation. By setting the rotation of the new object to this value it ensures that the new object will be in it's "natural" orientation. If you did set the rotation to some other value the object would be created with that rotation set so a new fly might be on it's side and it's flight path might touch the ground every time it makes a full revolution.
I hope this helps!