class_transform.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Transform.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Transform:
  5. Transform
  6. =========
  7. **Category:** Built-In Types
  8. Brief Description
  9. -----------------
  10. 3D Transformation. 3x4 matrix.
  11. Member Functions
  12. ----------------
  13. +------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  14. | :ref:`Transform<class_transform>` | :ref:`Transform<class_Transform_Transform>` **(** :ref:`Vector3<class_vector3>` x_axis, :ref:`Vector3<class_vector3>` y_axis, :ref:`Vector3<class_vector3>` z_axis, :ref:`Vector3<class_vector3>` origin **)** |
  15. +------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | :ref:`Transform<class_transform>` | :ref:`Transform<class_Transform_Transform>` **(** :ref:`Basis<class_basis>` basis, :ref:`Vector3<class_vector3>` origin **)** |
  17. +------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`Transform<class_transform>` | :ref:`Transform<class_Transform_Transform>` **(** :ref:`Transform2D<class_transform2d>` from **)** |
  19. +------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`Transform<class_transform>` | :ref:`Transform<class_Transform_Transform>` **(** :ref:`Quat<class_quat>` from **)** |
  21. +------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`Transform<class_transform>` | :ref:`Transform<class_Transform_Transform>` **(** :ref:`Basis<class_basis>` from **)** |
  23. +------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`Transform<class_transform>` | :ref:`affine_inverse<class_Transform_affine_inverse>` **(** **)** |
  25. +------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`Transform<class_transform>` | :ref:`interpolate_with<class_Transform_interpolate_with>` **(** :ref:`Transform<class_transform>` transform, :ref:`float<class_float>` weight **)** |
  27. +------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`Transform<class_transform>` | :ref:`inverse<class_Transform_inverse>` **(** **)** |
  29. +------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`Transform<class_transform>` | :ref:`looking_at<class_Transform_looking_at>` **(** :ref:`Vector3<class_vector3>` target, :ref:`Vector3<class_vector3>` up **)** |
  31. +------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`Transform<class_transform>` | :ref:`orthonormalized<class_Transform_orthonormalized>` **(** **)** |
  33. +------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`Transform<class_transform>` | :ref:`rotated<class_Transform_rotated>` **(** :ref:`Vector3<class_vector3>` axis, :ref:`float<class_float>` phi **)** |
  35. +------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`Transform<class_transform>` | :ref:`scaled<class_Transform_scaled>` **(** :ref:`Vector3<class_vector3>` scale **)** |
  37. +------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`Transform<class_transform>` | :ref:`translated<class_Transform_translated>` **(** :ref:`Vector3<class_vector3>` ofs **)** |
  39. +------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | var | :ref:`xform<class_Transform_xform>` **(** var v **)** |
  41. +------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | var | :ref:`xform_inv<class_Transform_xform_inv>` **(** var v **)** |
  43. +------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. Member Variables
  45. ----------------
  46. .. _class_Transform_basis:
  47. - :ref:`Basis<class_basis>` **basis** - The basis is a matrix containing 3 :ref:`Vector3<class_vector3>` as its columns: X axis, Y axis, and Z axis. These vectors can be interpreted as the basis vectors of local coordinate system traveling with the object.
  48. .. _class_Transform_origin:
  49. - :ref:`Vector3<class_vector3>` **origin** - The translation offset of the transform.
  50. Description
  51. -----------
  52. Represents one or many transformations in 3D space such as translation, rotation, or scaling. It consists of a :ref:`Basis<class_basis>` "basis" and an :ref:`Vector3<class_vector3>` "origin". It is similar to a 3x4 matrix.
  53. Member Function Description
  54. ---------------------------
  55. .. _class_Transform_Transform:
  56. - :ref:`Transform<class_transform>` **Transform** **(** :ref:`Vector3<class_vector3>` x_axis, :ref:`Vector3<class_vector3>` y_axis, :ref:`Vector3<class_vector3>` z_axis, :ref:`Vector3<class_vector3>` origin **)**
  57. Constructs the Transform from four :ref:`Vector3<class_vector3>`. Each axis corresponds to local basis vectors (some of which may be scaled).
  58. .. _class_Transform_Transform:
  59. - :ref:`Transform<class_transform>` **Transform** **(** :ref:`Basis<class_basis>` basis, :ref:`Vector3<class_vector3>` origin **)**
  60. Constructs the Transform from a :ref:`Basis<class_basis>` and :ref:`Vector3<class_vector3>`.
  61. .. _class_Transform_Transform:
  62. - :ref:`Transform<class_transform>` **Transform** **(** :ref:`Transform2D<class_transform2d>` from **)**
  63. Constructs the Transform from a :ref:`Transform2D<class_transform2d>`.
  64. .. _class_Transform_Transform:
  65. - :ref:`Transform<class_transform>` **Transform** **(** :ref:`Quat<class_quat>` from **)**
  66. Constructs the Transform from a :ref:`Quat<class_quat>`. The origin will be Vector3(0, 0, 0).
  67. .. _class_Transform_Transform:
  68. - :ref:`Transform<class_transform>` **Transform** **(** :ref:`Basis<class_basis>` from **)**
  69. Constructs the Transform from a :ref:`Basis<class_basis>`. The origin will be Vector3(0, 0, 0).
  70. .. _class_Transform_affine_inverse:
  71. - :ref:`Transform<class_transform>` **affine_inverse** **(** **)**
  72. Returns the inverse of the transform, under the assumption that the transformation is composed of rotation, scaling and translation.
  73. .. _class_Transform_interpolate_with:
  74. - :ref:`Transform<class_transform>` **interpolate_with** **(** :ref:`Transform<class_transform>` transform, :ref:`float<class_float>` weight **)**
  75. Interpolates the transform to other Transform by weight amount (0-1).
  76. .. _class_Transform_inverse:
  77. - :ref:`Transform<class_transform>` **inverse** **(** **)**
  78. Returns the inverse of the transform, under the assumption that the transformation is composed of rotation and translation (no scaling, use affine_inverse for transforms with scaling).
  79. .. _class_Transform_looking_at:
  80. - :ref:`Transform<class_transform>` **looking_at** **(** :ref:`Vector3<class_vector3>` target, :ref:`Vector3<class_vector3>` up **)**
  81. Returns a copy of the transform rotated such that its -Z axis points towards the ``target`` position.
  82. The transform will first be rotated around the given ``up`` vector, and then fully aligned to the target by a further rotation around an axis perpendicular to both the ``target`` and ``up`` vectors.
  83. Operations take place in global space.
  84. .. _class_Transform_orthonormalized:
  85. - :ref:`Transform<class_transform>` **orthonormalized** **(** **)**
  86. Returns the transform with the basis orthogonal (90 degrees), and normalized axis vectors.
  87. .. _class_Transform_rotated:
  88. - :ref:`Transform<class_transform>` **rotated** **(** :ref:`Vector3<class_vector3>` axis, :ref:`float<class_float>` phi **)**
  89. Rotates the transform around given axis by phi. The axis must be a normalized vector.
  90. .. _class_Transform_scaled:
  91. - :ref:`Transform<class_transform>` **scaled** **(** :ref:`Vector3<class_vector3>` scale **)**
  92. Scales the transform by the specified 3D scaling factors.
  93. .. _class_Transform_translated:
  94. - :ref:`Transform<class_transform>` **translated** **(** :ref:`Vector3<class_vector3>` ofs **)**
  95. Translates the transform by the specified offset.
  96. .. _class_Transform_xform:
  97. - var **xform** **(** var v **)**
  98. Transforms the given vector "v" by this transform.
  99. .. _class_Transform_xform_inv:
  100. - var **xform_inv** **(** var v **)**
  101. Inverse-transforms the given vector "v" by this transform.