Unity transform forward что это
Transform.forward
Success!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Submission failed
For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
Description
The blue axis of the transform in world space.
Manipulate a GameObject’s position on the Z axis (blue axis) of the transform in world space. Unlike Vector3.forward, Transform.forward moves the GameObject while also considering its rotation.
When a GameObject is rotated, the blue arrow representing the Z axis of the GameObject also changes direction. Transform.forward moves the GameObject in the blue arrow’s axis (Z).
For moving the GameObject on the Z axis while ignoring rotation, see Vector3.forward.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Is something described here not working as you expect it to? It might be a Known Issue. Please check with the Issue Tracker at
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
You’ve told us this page needs code samples. If you’d like to help us further, you could provide a code sample, or tell us about what kind of code sample you’d like to see:
You’ve told us there are code samples on this page which don’t work. If you know how to fix it, or have something better we could use instead, please let us know:
You’ve told us there is information missing from this page. Please tell us more about what’s missing:
You’ve told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You’ve told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You’ve told us there is a spelling or grammar error on this page. Please tell us what’s wrong:
You’ve told us this page has a problem. Please tell us more about what’s wrong:
Thanks for helping to make the Unity documentation better!
Is something described here not working as you expect it to? It might be a Known Issue. Please check with the Issue Tracker at issuetracker.unity3d.com.
Copyright © 2018 Unity Technologies. Publication: 2018.1-002N. Built: 2018-12-04.
Transform.forward
Success!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Submission failed
For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
Description
The blue axis of the transform in world space.
Manipulate a GameObject’s position on the Z axis (blue axis) of the transform in world space. Unlike Vector3.forward, Transform.forward moves the GameObject while also considering its rotation.
When a GameObject is rotated, the blue arrow representing the Z axis of the GameObject also changes direction. Transform.forward moves the GameObject in the blue arrow’s axis (Z).
For moving the GameObject on the Z axis while ignoring rotation, see Vector3.forward.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Is something described here not working as you expect it to? It might be a Known Issue. Please check with the Issue Tracker at
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Is something described here not working as you expect it to? It might be a Known Issue. Please check with the Issue Tracker at issuetracker.unity3d.com.
Copyright © 2017 Unity Technologies. Publication: 2017.2-001U. Built: 2017-12-08.
Transform.forward
Success!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Submission failed
For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
Description
Returns a normalized vector representing the blue axis of the transform in world space.
The example below shows how to manipulate a GameObject’s position on the Z axis (blue axis) of the transform in world space. Unlike Vector3.forward, Transform.forward moves the GameObject while also considering its rotation.
When a GameObject is rotated, the blue arrow representing the Z axis of the GameObject also changes direction. Transform.forward moves the GameObject in the blue arrow’s axis (Z).
For moving the GameObject on the Z axis while ignoring rotation, see Vector3.forward.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
Is something described here not working as you expect it to? It might be a Known Issue. Please check with the Issue Tracker at
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
You’ve told us this page needs code samples. If you’d like to help us further, you could provide a code sample, or tell us about what kind of code sample you’d like to see:
You’ve told us there are code samples on this page which don’t work. If you know how to fix it, or have something better we could use instead, please let us know:
You’ve told us there is information missing from this page. Please tell us more about what’s missing:
You’ve told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You’ve told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You’ve told us there is a spelling or grammar error on this page. Please tell us what’s wrong:
You’ve told us this page has a problem. Please tell us more about what’s wrong:
Thanks for helping to make the Unity documentation better!
Is something described here not working as you expect it to? It might be a Known Issue. Please check with the Issue Tracker at issuetracker.unity3d.com.
Copyright © 2020 Unity Technologies. Publication Date: 2021-02-24.
Transforms
The Transform Component
Properties
| Property: | Function: |
|---|---|
| Position | Position of the Transform in X, Y, and Z coordinates. |
| Rotation | Rotation of the Transform around the X, Y, and Z axes, measured in degrees. |
| Scale | Scale of the Transform along X, Y, and Z axes. Value “1” is the original size (size at which the object was imported). |
The position, rotation and scale values of a Transform are measured relative to the Transform’s parent. If the Transform has no parent, the properties are measured in world space.
Editing Transforms
Transforms are manipulated in 3D space in the X, Y, and Z axes or in 2D space in just X and Y. In Unity, these axes are represented by the colors red, green, and blue respectively.


The tools can be used on any object in the scene. When you click on an object, you will see the tool gizmo A graphic overlay associated with a GameObject in a Scene, and displayed in the Scene View. Built-in scene tools such as the move tool are Gizmos, and you can create custom Gizmos using textures or scripting. Some Gizmos are only drawn when the GameObject is selected, while other Gizmos are drawn by the Editor regardless of which GameObjects are selected. More info
See in Glossary appear within it. The appearance of the gizmo depends on which tool is selected.

When you click and drag on one of the three gizmo axes, you will notice that its color changes to yellow. As you drag the mouse, you will see the object translate, rotate, or scale along the selected axis. When you release the mouse button, the axis remains selected.

There is also an additional option in Translate mode to lock movement to a particular plane (ie, allow dragging in two of the axes while keeping the third unchanged). The three small coloured squares around the center of the Translate gizmo activate the lock for each plane; the colors correspond to the axis that will be locked when the square is clicked (eg, blue locks the Z axis).
Parenting
Parenting is one of the most important concepts to understand when using Unity. When a GameObject is a Parent An object that contains child objects in a hierarchy. When a GameObject is a Parent of another GameObject, the Child GameObject will move, rotate, and scale exactly as its Parent does. You can think of parenting as being like the relationship between your arms and your body; whenever your body moves, your arms also move along with it. More info
See in Glossary of another GameObject, the Child GameObject will move, rotate, and scale exactly as its Parent does. You can think of parenting as being like the relationship between your arms and your body; whenever your body moves, your arms also move along with it. Child objects can also have children of their own and so on. So your hands could be regarded as “children” of your arms and then each hand has several fingers, etc. Any object can have multiple children, but only one parent. These multiple levels of parent-child relationships form a Transform hierarchy. The object at the very top of a hierarchy (ie, the only object in the hierarchy that doesn’t have a parent) is known as the root.
You can create a Parent by dragging any GameObject in the Hierarchy View onto another. This will create a Parent-Child relationship between the two GameObjects.

Note that the Transform values in the Inspector for any child GameObject are displayed relative to the Parent’s Transform values. These values are referred to as local coordinates. Returning to the analogy of body and arms, the position of your body may move as you walk but your arms will still be attached at the same relative position. For scene construction, it is usually sufficient to work with local coordinates for child objects but in gameplay it is often useful to find their exact position in world space or global coordinates. The scripting API for the Transform component has separate properties for local and global position, rotation and scale and also allows you to convert any point between local and global coordinates.
Limitations with Non-Uniform Scaling
Non-uniform scaling is when the Scale in a Transform has different values for x, y, and z; for example (2, 4, 2). In contrast, uniform scaling has the same value for x, y, and z; for example (3, 3, 3). Non-uniform scaling can be useful in a few specific cases but it introduces a few oddities that don’t occur with uniform scaling:-
Importance of Scale
The scale of the Transform determines the difference between the size of a mesh in your modeling application and the size of that mesh in Unity. The mesh’s size in Unity (and therefore the Transform’s scale) is very important, especially during physics simulation. By default, the physics engine A system that simulates aspects of physical systems so that objects can accelerate correctly and be affected by collisions, gravity and other forces. More info
See in Glossary assumes that one unit in world space corresponds to one metre. If an object is very large, it can appear to fall in “slow motion”; the simulation is actually correct since effectively, you are watching a very large object falling a great distance.
There are three factors that can affect the scale of your object:
Ideally, you should not adjust the Scale of your object in the Transform Component. The best option is to create your models at real-life scale so you won’t have to change your Transform’s scale. The next best option is to adjust the scale at which your mesh is imported in the Import Settings for your individual mesh. Certain optimizations occur based on the import size, and instantiating an object that has an adjusted scale value can decrease performance. For more information, see the section about optimizing scale on the Rigidbody component reference page.
Unity transform forward что это
В прошлом посте, описывая подготовку модели к экспорту из 3Ds Max в Unity, я упомянул о проблеме, связанной с неправильным определением движком её передней части, т.е. того направления вектора, выходящего из центра модели, которое Unity считает «передним». Оно может не совпадать с вашими ожиданиями и смотреть совсем в другую сторону. Это особенно актуально, если модель была создана в редакторе из нескольких частей, если к ним применялись модификации вращения и т.п.
В чем проблема?
Применив правильные настройки при экспорте модели из 3Ds Max, вы добавили её в Unity3d. Вроде бы, все выглядит, как и должно быть: модель стоит прямо, смотрит в том же направлении, что и в редакторе… Но идиллия сохранится ровно до попытки взаимодействия с объектом. Как только вы попробуете «подтолкнуть» модель кодом вроде следующего:
Модель может начать двигаться в неожиданном направлении. В моём случае, танк поехал боком.
Как решить?
Чтобы избежать подобных оказий, в 3Ds Max, перед экспортом, во вкладке Utilities нужно кликнуть Reset XForm, выделив предварительно все полигоны, и нажать Reset Selected:
Как это работает?
Говоря простым языком, команда Reset XForm приводит все произведённые модификации над разными частями модели к одной системе координат и стороннее ПО при импорте не будет путаться, какую модификацию в каком порядке нужно применить к модели, чтобы она отобразилась в своём конечном состоянии.
Опытные люди рекомендую после Reset XForm выполнить также Collapse на той же вкладке Utilities.
После всех этих нехитрых операций, Unity должен начать корректно определять направление «вперед» для вашей модели. Конечно, для «бывалых» моделлеров это не новая информация, но новичкам она может помочь быстрее влиться в ряды «гейм-девелоперов», без особых проблем экспортировать свои модели из 3Ds Max в Unity3d и получать удовольствие от разработки игр.
Полезная статья? Их будет больше, если вы поддержите меня!
