mirror of
https://github.com/stan220/godot-docs.git
synced 2026-09-08 17:28:58 +00:00
Update tutorials: Rename Transform to Transform3D (#5603)
This commit is contained in:
@@ -265,7 +265,7 @@ class GDScriptLexer(RegexLexer):
|
||||
"Plane",
|
||||
"Quat",
|
||||
"Basis",
|
||||
"Transform",
|
||||
"Transform3D",
|
||||
"Color",
|
||||
"RID",
|
||||
"Object",
|
||||
|
||||
@@ -29,7 +29,7 @@ node for everything 3D.
|
||||
Spatial nodes have a local transform, which is relative to the parent
|
||||
node (as long as the parent node is also of **or inherits from** the type
|
||||
Spatial). This transform can be accessed as a 4×3
|
||||
:ref:`Transform <class_Transform>`, or as 3 :ref:`Vector3 <class_Vector3>`
|
||||
:ref:`Transform3D <class_Transform3D>`, or as 3 :ref:`Vector3 <class_Vector3>`
|
||||
members representing location, Euler rotation (X, Y and Z angles) and
|
||||
scale.
|
||||
|
||||
|
||||
@@ -341,7 +341,7 @@ Example of looking around, FPS style:
|
||||
_rotationY += mouseMotion.Relative.y * LookAroundSpeed;
|
||||
|
||||
// reset rotation
|
||||
Transform transform = Transform;
|
||||
Transform3D transform = Transform;
|
||||
transform.basis = Basis.Identity;
|
||||
Transform = transform;
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ efficient for millions of objects, but for a few thousands, GDScript should be f
|
||||
|
||||
# Set the transform of the instances.
|
||||
for i in multimesh.visible_instance_count:
|
||||
multimesh.set_instance_transform(i, Transform(Basis(), Vector3(i * 20, 0, 0)))
|
||||
multimesh.set_instance_transform(i, Transform3D(Basis(), Vector3(i * 20, 0, 0)))
|
||||
|
||||
.. code-tab:: csharp C#
|
||||
|
||||
@@ -95,7 +95,7 @@ efficient for millions of objects, but for a few thousands, GDScript should be f
|
||||
// Set the transform of the instances.
|
||||
for (int i = 0; i < Multimesh.VisibleInstanceCount; i++)
|
||||
{
|
||||
Multimesh.SetInstanceTransform(i, new Transform(Basis.Identity, new Vector3(i * 20, 0, 0)));
|
||||
Multimesh.SetInstanceTransform(i, new Transform3D(Basis.Identity, new Vector3(i * 20, 0, 0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ The 3D APIs are different from the 2D ones, so the instantiation API must be use
|
||||
mesh = load("res://mymesh.obj")
|
||||
RenderingServer.instance_set_base(instance, mesh)
|
||||
# Move the mesh around.
|
||||
var xform = Transform(Basis(), Vector3(20, 100, 0))
|
||||
var xform = Transform3D(Basis(), Vector3(20, 100, 0))
|
||||
RenderingServer.instance_set_transform(instance, xform)
|
||||
|
||||
Creating a 2D RigidBody and moving a sprite with it
|
||||
|
||||
@@ -220,7 +220,7 @@ to loop over all the instances and set their transform to a random position.
|
||||
::
|
||||
|
||||
for i in range($School.multimesh.instance_count):
|
||||
var position = Transform()
|
||||
var position = Transform3D()
|
||||
position = position.translated(Vector3(randf() * 100 - 50, randf() * 50 - 25, randf() * 50 - 25))
|
||||
$School.multimesh.set_instance_transform(i, position)
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ Here is a custom ``look_at()`` method that will work reliably with rigid bodies:
|
||||
|
||||
class Body : RigidBody
|
||||
{
|
||||
private void LookFollow(PhysicsDirectBodyState state, Transform currentTransform, Vector3 targetPosition)
|
||||
private void LookFollow(PhysicsDirectBodyState state, Transform3D currentTransform, Vector3 targetPosition)
|
||||
{
|
||||
var upDir = new Vector3(0, 1, 0);
|
||||
var curDir = currentTransform.basis.Xform(new Vector3(0, 0, 1));
|
||||
|
||||
@@ -549,7 +549,7 @@ and ``size``. Also contains an ``end`` field which is
|
||||
(``x``, ``y`` and ``z``) and can also be accessed as an array of 3D
|
||||
vectors.
|
||||
|
||||
:ref:`Transform <class_Transform>`
|
||||
:ref:`Transform3D <class_Transform3D>`
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
3D Transform contains a Basis field ``basis`` and a Vector3 field
|
||||
|
||||
@@ -797,7 +797,7 @@ table of the corresponding types:
|
||||
+-----------------+-----------+
|
||||
| **Color** | **vec4** |
|
||||
+-----------------+-----------+
|
||||
| **Transform** | **mat4** |
|
||||
| **Transform3D** | **mat4** |
|
||||
+-----------------+-----------+
|
||||
| **Transform2D** | **mat4** |
|
||||
+-----------------+-----------+
|
||||
|
||||
Reference in New Issue
Block a user