TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

Unity Transforms and Object Parenting

Unity Transforms and Object Parenting with Introduction, Installing, GameObject, First Unity Project, Unity 2D, Sprite Unity, Loops, If Statement, Swith Statements, Unity UI, Unity Asset Store etc.

<< Back to UNITY

Transforms and Object Parenting

In Unity, the Transform component has three visible properties - the position, rotation, and scale. Each of these properties has three values for the three axes. Means, Transform is used to determine the Position, Rotation, and Scale of each object in the scene. Every GameObject has a Transform.

Transforms and Object Parenting

Properties

Position: This is the position of the transform in X, Y, and Z coordinates. 2D games generally do not focus on the Z-axis when it comes to positioning. The most frequent use of the Z-axis in 2D games is in the creation of parallax.

Rotation: This property defines the amount of rotation (measured in degree) an object is rotated about that axis with respect to the game world or the parent object.

Scale: The scale of the object defines how large it is when compared to its original or native size. For example, let us take a square of 2x2 dimensions. If the square is scaled against the X-axis by 3 and the Y-axis by 2 we will get a square of size 6x4.

These properties are measured relative to the transform's parent. If the transform has no parent, the properties are calculated in world space.

Object Parenting

In Unity, GameObjects follow a Hierarchy system. Using this hierarchy system, GameObjects can become parents of other GameObjects. When a GameObject has a parent, it will perform all its transform changes with respect to another GameObject instead of the game world.

A parent object causes all children objects to move and rotate the same way the parent object does, although moving children objects does not have any effect on the parent. Children themselves can be parents; e.g., your hand is the child of your arm, and fingers are children of your hand.

Parenting GameObjects has a number of uses. For example, all the different parts of a tank could be separate GameObjects, parented under a single GameObject named "tank." Hence, when this "tank" parent GameObject moves, all the parts move along with it because their positioning is updated constantly according to their parent.

Transforms and Object Parenting
Next TopicInternal Assets




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf