diff --git a/_tools/redirects/redirects.csv b/_tools/redirects/redirects.csv index 03dbafb90..70a372915 100644 --- a/_tools/redirects/redirects.csv +++ b/_tools/redirects/redirects.csv @@ -333,3 +333,4 @@ source,destination /tutorials/viewports/multiple_resolutions.html,/tutorials/rendering/multiple_resolutions.html /tutorials/viewports/using_viewport_as_texture.html,/tutorials/shaders/using_viewport_as_texture.html /tutorials/viewports/viewports.html,/tutorials/rendering/viewports.html +/tutorials/physics/using_kinematic_body_2d.html,/tutorials/physics/using_character_body_2d.html diff --git a/community/contributing/docs_writing_guidelines.rst b/community/contributing/docs_writing_guidelines.rst index f1e0e2282..4ffd4170d 100644 --- a/community/contributing/docs_writing_guidelines.rst +++ b/community/contributing/docs_writing_guidelines.rst @@ -270,14 +270,14 @@ From the Oxford dictionary: :: - Create a KinematicBody2D node, a CollisionShape2D node and a sprite node. + Create a CharacterBody2D node, a CollisionShape2D node and a sprite node. **Do** add a comma before `and` or `or`, for the last element of a list with more than two elements. :: - Create a KinematicBody2D node, a CollisionShape2D node, and a sprite node. + Create a CharacterBody2D node, a CollisionShape2D node, and a sprite node. How to write methods and classes @@ -483,7 +483,7 @@ The Animation, Debugger, etc. at the bottom of the viewport are Foldable areas of the Inspector are ``sections``. The node's parent class names, which you can't fold, are ``Classes`` e.g. the -``KinematicBody2D class``. And individual lines with key-value pairs are +``CharacterBody2D class``. And individual lines with key-value pairs are ``properties``. E.g. ``position`` or ``modulate color`` are both ``properties``. diff --git a/development/cpp/object_class.rst b/development/cpp/object_class.rst index 4016fe9d8..92dd240f2 100644 --- a/development/cpp/object_class.rst +++ b/development/cpp/object_class.rst @@ -247,14 +247,14 @@ More information can be found on the :ref:`doc_godot_notifications` page. References ---------- -:ref:`Reference ` inherits from Object and holds a +:ref:`RefCounted ` inherits from Object and holds a reference count. It is the base for reference counted object types. Declaring them must be done using Ref<> template. For example: .. code-block:: cpp - class MyReference: public Reference { - GDCLASS(MyReference, Reference); + class MyReference: public RefCounted { + GDCLASS(MyReference, RefCounted); }; Ref myref(memnew(MyReference)); @@ -265,7 +265,7 @@ templates point to it. References: ~~~~~~~~~~~ -- `core/object/reference.h `__ +- `core/object/reference.h `__ Resources: ---------- diff --git a/getting_started/first_3d_game/02.player_input.rst b/getting_started/first_3d_game/02.player_input.rst index eb8b16d12..453be8152 100644 --- a/getting_started/first_3d_game/02.player_input.rst +++ b/getting_started/first_3d_game/02.player_input.rst @@ -11,11 +11,11 @@ that moves in eight directions. .. player_movement.gif Create a new scene by going to the Scene menu in the top-left and clicking *New -Scene*. Create a *KinematicBody* node as the root and name it *Player*. +Scene*. Create a *CharacterBody3D* node as the root and name it *Player*. |image0| -Kinematic bodies are complementary to the area and rigid bodies used in the 2D +Character bodies are complementary to the area and rigid bodies used in the 2D game tutorial. Like rigid bodies, they can move and collide with the environment, but instead of being controlled by the physics engine, you dictate their movement. You will see how we use the node's unique features when we code diff --git a/getting_started/first_3d_game/03.player_movement_code.rst b/getting_started/first_3d_game/03.player_movement_code.rst index be733aed8..9b28d83c7 100644 --- a/getting_started/first_3d_game/03.player_movement_code.rst +++ b/getting_started/first_3d_game/03.player_movement_code.rst @@ -19,7 +19,7 @@ character. .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody + extends CharacterBody3D # How fast the player moves in meters per second. @export var speed = 14 @@ -30,7 +30,7 @@ character. .. code-tab:: csharp - public class Player : KinematicBody + public class Player : CharacterBody3D { // Don't forget to rebuild the project so the editor knows about the new export variable. @@ -214,8 +214,8 @@ The physics engine can only detect interactions with walls, the floor, or other bodies during a given frame if movement and collisions happen. We will use this property later to code the jump. -On the last line, we call ``KinematicBody.move_and_slide()``. It's a powerful -method of the ``KinematicBody`` class that allows you to move a character +On the last line, we call ``CharacterBody3D.move_and_slide()``. It's a powerful +method of the ``CharacterBody3D`` class that allows you to move a character smoothly. If it hits a wall midway through a motion, the engine will try to smooth it out for you. @@ -233,7 +233,7 @@ Here is the complete ``Player.gd`` code for reference. .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody + extends CharacterBody3D # How fast the player moves in meters per second. @export var speed = 14 @@ -266,7 +266,7 @@ Here is the complete ``Player.gd`` code for reference. .. code-tab:: csharp - public class Player : KinematicBody + public class Player : CharacterBody3D { // How fast the player moves in meters per second. [Export] diff --git a/getting_started/first_3d_game/04.mob_scene.rst b/getting_started/first_3d_game/04.mob_scene.rst index 8e0fa68e1..58a36b2d9 100644 --- a/getting_started/first_3d_game/04.mob_scene.rst +++ b/getting_started/first_3d_game/04.mob_scene.rst @@ -9,7 +9,7 @@ next lesson, we'll spawn them randomly around the playable area. Let's design the monsters themselves in a new scene. The node structure is going to be similar to the *Player* scene. -Create a scene with, once again, a *KinematicBody* node as its root. Name it +Create a scene with, once again, a *CharacterBody3D* node as its root. Name it *Mob*. Add a *Spatial* node as a child of it, name it *Pivot*. And drag and drop the file ``mob.glb`` from the *FileSystem* dock onto the *Pivot* to add the monster's 3D model to the scene. You can rename the newly created *mob* node @@ -100,7 +100,7 @@ the ``velocity``. .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody + extends CharacterBody3D # Minimum speed of the mob in meters per second. @export var min_speed = 10 @@ -115,7 +115,7 @@ the ``velocity``. .. code-tab:: csharp - public class Mob : KinematicBody + public class Mob : CharacterBody3D { // Don't forget to rebuild the project so the editor knows about the new export variable. @@ -135,7 +135,7 @@ the ``velocity``. } Similarly to the player, we move the mob every frame by calling -``KinematicBody``\ 's ``move_and_slide()`` method. This time, we don't update +``CharacterBody3D``\ 's ``move_and_slide()`` method. This time, we don't update the ``velocity`` every frame: we want the monster to move at a constant speed and leave the screen, even if it were to hit an obstacle. @@ -254,7 +254,7 @@ Here is the complete ``Mob.gd`` script for reference. .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody + extends CharacterBody3D # Minimum speed of the mob in meters per second. @export var min_speed = 10 @@ -281,7 +281,7 @@ Here is the complete ``Mob.gd`` script for reference. .. code-tab:: csharp - public class Mob : KinematicBody + public class Mob : CharacterBody3D { // Minimum speed of the mob in meters per second [Export] diff --git a/getting_started/first_3d_game/06.jump_and_squash.rst b/getting_started/first_3d_game/06.jump_and_squash.rst index 908948285..d31ed67b2 100644 --- a/getting_started/first_3d_game/06.jump_and_squash.rst +++ b/getting_started/first_3d_game/06.jump_and_squash.rst @@ -157,7 +157,7 @@ called ``move_and_slide()``. That's all you need to jump! -The ``is_on_floor()`` method is a tool from the ``KinematicBody`` class. It +The ``is_on_floor()`` method is a tool from the ``CharacterBody3D`` class. It returns ``true`` if the body collided with the floor in this frame. That's why we apply gravity to the *Player*: so we collide with the floor instead of floating over it like the monsters. @@ -258,7 +258,7 @@ With this code, if no collisions occurred on a given frame, the loop won't run. for (int index = 0; index < GetSlideCount(); index++) { // We check every collision that occurred this frame. - KinematicCollision collision = GetSlideCollision(index); + KinematicCollision3D collision = GetSlideCollision(index); // If we collide with a monster... if (collision.Collider is Mob mob && mob.IsInGroup("mob")) { @@ -276,11 +276,11 @@ With this code, if no collisions occurred on a given frame, the loop won't run. That's a lot of new functions. Here's some more information about them. The functions ``get_slide_count()`` and ``get_slide_collision()`` both come from -the :ref:`KinematicBody` class and are related to +the :ref:`CharacterBody3D` class and are related to ``move_and_slide()``. ``get_slide_collision()`` returns a -:ref:`KinematicCollision` object that holds +:ref:`KinematicCollision3D` object that holds information about where and how the collision occurred. For example, we use its ``collider`` property to check if we collided with a "mob" by calling ``is_in_group()`` on it: ``collision.collider.is_in_group("mob")``. diff --git a/getting_started/first_3d_game/07.killing_player.rst b/getting_started/first_3d_game/07.killing_player.rst index 672a8c423..0c9154ada 100644 --- a/getting_started/first_3d_game/07.killing_player.rst +++ b/getting_started/first_3d_game/07.killing_player.rst @@ -52,7 +52,7 @@ one to the *Player* node. In the *Node* tab, double-click the |image4| -The *MobDetector* will emit ``body_entered`` when a *KinematicBody* or a +The *MobDetector* will emit ``body_entered`` when a *CharacterBody3D* or a *RigidBody* node enters it. As it only masks the "enemies" physics layers, it will only detect the *Mob* nodes. @@ -228,7 +228,7 @@ Next is ``Mob.gd``. .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody + extends CharacterBody3D # Emitted when the player jumped on the mob. signal squashed @@ -264,7 +264,7 @@ Next is ``Mob.gd``. .. code-tab:: csharp - public class Mob : KinematicBody + public class Mob : CharacterBody3D { // Emitted when the played jumped on the mob. [Signal] @@ -311,7 +311,7 @@ Finally, the longest script, ``Player.gd``. .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody + extends CharacterBody3D # Emitted when a mob hit the player. signal hit @@ -373,7 +373,7 @@ Finally, the longest script, ``Player.gd``. .. code-tab:: csharp - public class Player : KinematicBody + public class Player : CharacterBody3D { // Emitted when the player was hit by a mob. [Signal] @@ -435,7 +435,7 @@ Finally, the longest script, ``Player.gd``. for (int index = 0; index < GetSlideCount(); index++) { - KinematicCollision collision = GetSlideCollision(index); + KinematicCollision3D collision = GetSlideCollision(index); if (collision.Collider is Mob mob && mob.IsInGroup("mob")) { if (Vector3.Up.Dot(collision.Normal) > 0.1f) diff --git a/getting_started/first_3d_game/09.adding_animations.rst b/getting_started/first_3d_game/09.adding_animations.rst index 1ef7a2754..49e11712f 100644 --- a/getting_started/first_3d_game/09.adding_animations.rst +++ b/getting_started/first_3d_game/09.adding_animations.rst @@ -282,7 +282,7 @@ Here's the *Player* script. .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody + extends CharacterBody3D # Emitted when the player was hit by a mob. signal hit @@ -349,7 +349,7 @@ Here's the *Player* script. .. code-tab:: csharp - public class Player : KinematicBody + public class Player : CharacterBody3D { // Emitted when the player was hit by a mob. [Signal] @@ -416,7 +416,7 @@ Here's the *Player* script. for (int index = 0; index < GetSlideCount(); index++) { - KinematicCollision collision = GetSlideCollision(index); + KinematicCollision3D collision = GetSlideCollision(index); if (collision.Collider is Mob mob && mob.IsInGroup("mob")) { if (Vector3.Up.Dot(collision.Normal) > 0.1f) @@ -449,7 +449,7 @@ And the *Mob*'s script. .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody + extends CharacterBody3D # Emitted when the player jumped on the mob. signal squashed @@ -487,7 +487,7 @@ And the *Mob*'s script. .. code-tab:: csharp - public class Mob : KinematicBody + public class Mob : CharacterBody3D { // Emitted when the played jumped on the mob. [Signal] diff --git a/getting_started/introduction/key_concepts_overview.rst b/getting_started/introduction/key_concepts_overview.rst index f25f7182d..2af311785 100644 --- a/getting_started/introduction/key_concepts_overview.rst +++ b/getting_started/introduction/key_concepts_overview.rst @@ -40,7 +40,7 @@ nodes. .. image:: img/key_concepts_character_nodes.png -It is made of a ``KinematicBody2D`` node named "Character", a ``Sprite2D``, a +It is made of a ``CharacterBody2D`` node named "Character", a ``Sprite2D``, a ``Camera2D``, and a ``CollisionShape2D``. .. note:: The node names end with "2D" because this is a 2D scene. Their 3D diff --git a/getting_started/step_by_step/scripting_first_script.rst b/getting_started/step_by_step/scripting_first_script.rst index cf4932bd1..cbcaa257d 100644 --- a/getting_started/step_by_step/scripting_first_script.rst +++ b/getting_started/step_by_step/scripting_first_script.rst @@ -121,7 +121,7 @@ node, including classes it extends, like ``Node2D``, ``CanvasItem``, and ``Node``. .. note:: In GDScript, if you omit the line with the ``extends`` keyword, your - class will implicitly extend :ref:`Reference `, which + class will implicitly extend :ref:`RefCounted `, which Godot uses to manage your application's memory. Inherited properties include the ones you can see in the Inspector dock, like diff --git a/tutorials/2d/2d_movement.rst b/tutorials/2d/2d_movement.rst index c257d1ddf..cb58a6f8b 100644 --- a/tutorials/2d/2d_movement.rst +++ b/tutorials/2d/2d_movement.rst @@ -10,7 +10,7 @@ Every beginner has been there: "How do I move my character?" Depending on the style of game you're making, you may have special requirements, but in general the movement in most 2D games is based on a small number of designs. -We'll use :ref:`KinematicBody2D ` for these examples, +We'll use :ref:`CharacterBody2D ` for these examples, but the principles will apply to other node types (Area2D, RigidBody2D) as well. .. _doc_2d_movement_setup: @@ -18,7 +18,7 @@ but the principles will apply to other node types (Area2D, RigidBody2D) as well. Setup ----- -Each example below uses the same scene setup. Start with a ``KinematicBody2D`` with two +Each example below uses the same scene setup. Start with a ``CharacterBody2D`` with two children: ``Sprite2D`` and ``CollisionShape2D``. You can use the Godot icon ("icon.png") for the Sprite2D's texture or use any other 2D image you have. @@ -41,7 +41,7 @@ Add a script to the kinematic body and add the following code: .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody2D + extends CharacterBody2D export (int) var speed = 200 @@ -68,7 +68,7 @@ Add a script to the kinematic body and add the following code: using Godot; using System; - public class Movement : KinematicBody2D + public class Movement : CharacterBody2D { [Export] public int speed = 200; @@ -129,7 +129,7 @@ while up/down moves it forward or backward in whatever direction it's facing. .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody2D + extends CharacterBody2D export (int) var speed = 200 export (float) var rotation_speed = 1.5 @@ -159,7 +159,7 @@ while up/down moves it forward or backward in whatever direction it's facing. using Godot; using System; - public class Movement : KinematicBody2D + public class Movement : CharacterBody2D { [Export] public int speed = 200; [Export] public float rotationSpeed = 1.5f; @@ -216,7 +216,7 @@ is set by the mouse position instead of the keyboard. The character will always .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody2D + extends CharacterBody2D export (int) var speed = 200 @@ -239,7 +239,7 @@ is set by the mouse position instead of the keyboard. The character will always using Godot; using System; - public class Movement : KinematicBody2D + public class Movement : CharacterBody2D { [Export] public int speed = 200; @@ -291,7 +291,7 @@ on the screen will cause the player to move to the target location. .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody2D + extends CharacterBody2D export (int) var speed = 200 @@ -313,7 +313,7 @@ on the screen will cause the player to move to the target location. using Godot; using System; - public class Movement : KinematicBody2D + public class Movement : CharacterBody2D { [Export] public int speed = 200; diff --git a/tutorials/2d/2d_sprite_animation.rst b/tutorials/2d/2d_sprite_animation.rst index 2a4d1eb54..1a36fe84c 100644 --- a/tutorials/2d/2d_sprite_animation.rst +++ b/tutorials/2d/2d_sprite_animation.rst @@ -76,7 +76,7 @@ released. .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody2D + extends CharacterBody2D onready var _animated_sprite = $AnimatedSprite2D @@ -88,7 +88,7 @@ released. .. code-tab:: csharp - public class Character : KinematicBody2D + public class Character : CharacterBody2D { private AnimatedSprite2D _animatedSprite; @@ -215,7 +215,7 @@ released. .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody2D + extends CharacterBody2D onready var _animation_player = $AnimationPlayer @@ -227,7 +227,7 @@ released. .. code-tab:: csharp - public class Character : KinematicBody2D + public class Character : CharacterBody2D { private AnimationPlayer _animationPlayer; diff --git a/tutorials/2d/2d_transforms.rst b/tutorials/2d/2d_transforms.rst index a03a165d2..0184781c6 100644 --- a/tutorials/2d/2d_transforms.rst +++ b/tutorials/2d/2d_transforms.rst @@ -40,8 +40,7 @@ resizing or stretching the screen. This transform is used internally (as described in :ref:`doc_multiple_resolutions`), but can also be manually set on each viewport. -Input events received in the :ref:`MainLoop._input_event() ` -callback are multiplied by this transform but lack the ones above. To +Input events are multiplied by this transform but lack the ones above. To convert InputEvent coordinates to local CanvasItem coordinates, the :ref:`CanvasItem.make_input_local() ` function was added for convenience. diff --git a/tutorials/2d/custom_drawing_in_2d.rst b/tutorials/2d/custom_drawing_in_2d.rst index f5c52606c..a3a82a575 100644 --- a/tutorials/2d/custom_drawing_in_2d.rst +++ b/tutorials/2d/custom_drawing_in_2d.rst @@ -58,7 +58,7 @@ The ``_draw()`` function is only called once, and then the draw commands are cached and remembered, so further calls are unnecessary. If re-drawing is required because a state or something else changed, -call :ref:`CanvasItem.update() ` +call :ref:`CanvasItem.queue_redraw() ` in that same node and a new ``_draw()`` call will happen. Here is a little more complex example, a texture variable that will be diff --git a/tutorials/2d/particle_systems_2d.rst b/tutorials/2d/particle_systems_2d.rst index f11d2f872..8bf9e7268 100644 --- a/tutorials/2d/particle_systems_2d.rst +++ b/tutorials/2d/particle_systems_2d.rst @@ -19,34 +19,34 @@ parameters and then adding randomness to them. Particle nodes ~~~~~~~~~~~~~~ -Godot provides two different nodes for 2D particles, :ref:`class_Particles2D` and +Godot provides two different nodes for 2D particles, :ref:`class_GPUParticles2D` and :ref:`class_CPUParticles2D`. -Particles2D is more advanced and uses the GPU to process particle effects, but that limits +GPUParticles2D is more advanced and uses the GPU to process particle effects, but that limits it to higher end graphics API, and in our case to the GLES3 renderer. For projects using the GLES2 backend, CPUParticles2D is a CPU-driven option with near feature parity with -Particles2D, but lesser performance. While Particles2D is configured via a -:ref:`class_ParticlesMaterial` (and optionally with a custom shader), the matching options +GPUParticles2D, but lesser performance. While GPUParticles2D is configured via a +:ref:`class_ParticleProcessMaterial` (and optionally with a custom shader), the matching options are provided via node properties in CPUParticles2D (with the exception of the trail settings). -You can convert a Particles2D node into a CPUParticles2D node by clicking on the node in the +You can convert a GPUParticles2D node into a CPUParticles2D node by clicking on the node in the inspector, and selecting "Convert to CPUParticles2D" in the "Particles" menu of the toolbar. .. image:: img/particles_convert.png -The rest of this tutorial is going to use the Particles2D node. First, add a Particles2D +The rest of this tutorial is going to use the GPUParticles2D node. First, add a GPUParticles2D node to your scene. After creating that node you will notice that only a white dot was created, -and that there is a warning icon next to your Particles2D node in the scene dock. This -is because the node needs a ParticlesMaterial to function. +and that there is a warning icon next to your GPUParticles2D node in the scene dock. This +is because the node needs a ParticleProcessMaterial to function. -ParticlesMaterial -~~~~~~~~~~~~~~~~~ +ParticleProcessMaterial +~~~~~~~~~~~~~~~~~~~~~~~ To add a process material to your particles node, go to ``Process Material`` in your inspector panel. Click on the box next to ``Material``, and from the dropdown -menu select ``New ParticlesMaterial``. +menu select ``New ParticleProcessMaterial``. .. image:: img/particles_material.png -Your Particles2D node should now be emitting +Your GPUParticles2D node should now be emitting white points downward. .. image:: img/particles1.png @@ -80,7 +80,7 @@ Lifetime: 4.0 One Shot ~~~~~~~~ -When enabled, a Particles2D node will emit all of its particles once +When enabled, a GPUParticles2D node will emit all of its particles once and then never again. Preprocess @@ -149,7 +149,7 @@ The rectangle's ``W`` and ``H`` properties respectively control its Width and it The ``X`` and ``Y`` properties control the position of the upper-left corner of the rectangle, relative to the particle emitter. -You can have Godot generate a Visibility Rect automatically using the toolbar above the 2d view. To do so, select the Particles2D node and Click ``Particles > Generate Visibility Rect``. Godot will simulate the Particles2D node emitting particles for a few seconds and set the rectangle to fit the surface the particles take. +You can have Godot generate a Visibility Rect automatically using the toolbar above the 2d view. To do so, select the GPUParticles2D node and Click ``Particles > Generate Visibility Rect``. Godot will simulate the Particles2D node emitting particles for a few seconds and set the rectangle to fit the surface the particles take. You can control the emit duration with the ``Generation Time (sec)`` option. The maximum value is 25 seconds. If you need more time for your particles to move around, you can temporarily change the ``preprocess`` duration on the Particles2D node. @@ -174,8 +174,8 @@ This controls the order in which individual particles are drawn. ``Index`` means particles are drawn according to their emission order (default). ``Lifetime`` means they are drawn in order of remaining lifetime. -ParticlesMaterial settings --------------------------- +ParticleProcessMaterial settings +-------------------------------- Direction ~~~~~~~~~ @@ -303,11 +303,11 @@ randomness ratio. Emission Shapes --------------- -ParticlesMaterials allow you to set an Emission Mask, which dictates +ParticleProcessMaterials allow you to set an Emission Mask, which dictates the area and direction in which particles are emitted. These can be generated from textures in your project. -Ensure that a ParticlesMaterial is set, and the Particles2D node is selected. +Ensure that a ParticleProcessMaterial is set, and the GPUParticles2D node is selected. A "Particles" menu should appear in the Toolbar: .. image:: img/emission_shapes1.png @@ -348,7 +348,7 @@ Emission Colors ``Capture from Pixel`` will cause the particles to inherit the color of the mask at their spawn points. -Once you click "OK", the mask will be generated and set to the ParticlesMaterial, under the ``Emission Shape`` section: +Once you click "OK", the mask will be generated and set to the ParticleProcessMaterial, under the ``Emission Shape`` section: .. image:: img/emission_shapes4.png diff --git a/tutorials/3d/csg_tools.rst b/tutorials/3d/csg_tools.rst index a654522ca..860131149 100644 --- a/tutorials/3d/csg_tools.rst +++ b/tutorials/3d/csg_tools.rst @@ -13,7 +13,7 @@ Interior environments can be created by using inverted primitives. .. note:: The CSG nodes in Godot are mainly intended for prototyping. There is no built-in support for UV mapping or editing 3D polygons (though - extruded 2D polygons can be used with the CSGPolygon node). + extruded 2D polygons can be used with the CSGPolygon3D node). If you're looking for an easy to use level design tool for a project, you may want to use `Qodot `__ @@ -29,13 +29,13 @@ Introduction to CSG nodes Like other features of Godot, CSG is supported in the form of nodes. These are the CSG nodes: -- :ref:`CSGBox ` -- :ref:`CSGCylinder ` (also supports cone) -- :ref:`CSGSphere ` -- :ref:`CSGTorus ` -- :ref:`CSGPolygon ` -- :ref:`CSGMesh ` -- :ref:`CSGCombiner ` +- :ref:`CSGBox3D ` +- :ref:`CSGCylinder3D ` (also supports cone) +- :ref:`CSGSphere3D ` +- :ref:`CSGTorus3D ` +- :ref:`CSGPolygon3D ` +- :ref:`CSGMesh3D ` +- :ref:`CSGCombiner3D ` .. image:: img/csg_nodes.png @@ -59,7 +59,7 @@ Every CSG node supports 3 kinds of boolean operations: CSGPolygon ~~~~~~~~~~ -The :ref:`CSGPolygon ` node extrude along a Polygon drawn in +The :ref:`CSGPolygon3D ` node extrude along a Polygon drawn in 2D (in X, Y coordinates) in the following ways: - **Depth:** Extruded back a given amount. @@ -71,15 +71,15 @@ The :ref:`CSGPolygon ` node extrude along a Polygon drawn in .. image:: img/csg_poly.png -.. note:: The **Path** mode must be provided with a :ref:`Path ` +.. note:: The **Path** mode must be provided with a :ref:`Path3D ` node to work. In the Path node, draw the path and the polygon in - CSGPolygon will extrude along the given path. + CSGPolygon3D will extrude along the given path. Custom meshes ~~~~~~~~~~~~~ -Any mesh can be used for :ref:`CSGMesh `; the mesh can be +Any mesh can be used for :ref:`CSGMesh3D `; the mesh can be modelled in other software and imported into Godot. Multiple materials are supported. There are some restrictions for geometry: @@ -90,10 +90,10 @@ supported. There are some restrictions for geometry: .. image:: img/csg_custom_mesh.png -CSGCombiner -~~~~~~~~~~~ +CSGCombiner3D +~~~~~~~~~~~~~ -The :ref:`CSGCombiner ` node is an empty shape used for +The :ref:`CSGCombiner3D ` node is an empty shape used for organization. It will only combine children nodes. Processing order @@ -135,44 +135,44 @@ Create a scene with a Spatial node as root node. .. image:: img/csg_overdraw.png -Create a CSGBox and name it ``room``, enable **Invert Faces** and change the +Create a CSGBox3D and name it ``room``, enable **Invert Faces** and change the dimensions of your room. .. image:: img/csg_room.png .. image:: img/csg_room_invert.png -Next, create a CSGCombiner and name it ``desk``. +Next, create a CSGCombiner3D and name it ``desk``. A desk has one surface and 4 legs: -- Create 1 CSGBox children node in **Union** mode for the surface +- Create 1 CSGBox3D children node in **Union** mode for the surface and adjust the dimensions. -- Create 4 CSGBox children nodes in **Union** mode for the legs +- Create 4 CSGBox3D children nodes in **Union** mode for the legs and adjust the dimensions. Adjust their placement to resemble a desk. .. image:: img/csg_desk.png -.. note:: CSG nodes inside a CSGCombiner will only process their operation - within the combiner. Therefore, CSGCombiners are used to organize +.. note:: CSG nodes inside a CSGCombiner3D will only process their operation + within the combiner. Therefore, CSGCombiner3Ds are used to organize CSG nodes. -Create a CSGCombiner and name it ``bed``. +Create a CSGCombiner3D and name it ``bed``. -Our bed consists of 3 parts: the bed, the mattress and a pillow. Create a CSGBox -and adjust its dimension for the bed. Create another CSGBox and adjust its +Our bed consists of 3 parts: the bed, the mattress and a pillow. Create a CSGBox3D +and adjust its dimension for the bed. Create another CSGBox3D and adjust its dimension for the mattress. .. image:: img/csg_bed_mat.png -We will create another CSGCombiner named ``pillow`` as the child of ``bed``. +We will create another CSGCombiner3D named ``pillow`` as the child of ``bed``. The scene tree should look like this: .. image:: img/csg_bed_tree.png -We will combine 3 CSGSphere nodes in **Union** mode to form a pillow. Scale the +We will combine 3 CSGSphere3D nodes in **Union** mode to form a pillow. Scale the Y axis of the spheres and enable **Smooth Faces**. .. image:: img/csg_pillow_smooth.png @@ -186,8 +186,8 @@ Try to re-parent the ``pillow`` node to the root ``Spatial`` node; the hole will disappear. .. note:: This is to illustrate the effect of CSG processing order. - Since the root node is not a CSG node, the CSGCombiner nodes are - the end of the operations; this shows the use of CSGCombiner to + Since the root node is not a CSG node, the CSGCombiner3D nodes are + the end of the operations; this shows the use of CSGCombiner3D to organize the CSG scene. Undo the re-parent after observing the effect. The bed you've built should look @@ -195,16 +195,16 @@ like this: .. image:: img/csg_bed.png -Create a CSGCombiner and name it ``lamp``. +Create a CSGCombiner3D and name it ``lamp``. A lamp consists of 3 parts: the stand, the pole and the lampshade. -Create a CSGCylinder, enable the **Cone** option and make it the stand. Create -another CSGCylinder and adjust the dimensions to use it as a pole. +Create a CSGCylinder3D, enable the **Cone** option and make it the stand. Create +another CSGCylinder3D and adjust the dimensions to use it as a pole. .. image:: img/csg_lamp_pole_stand.png -We will use a CSGPolygon for the lampshade. Use the **Spin** mode for the -CSGPolygon and draw a `trapezoid `_ +We will use a CSGPolygon3D for the lampshade. Use the **Spin** mode for the +CSGPolygon3D and draw a `trapezoid `_ while in **Front View** (numeric keypad 1); this shape will extrude around the origin and form the lampshade. @@ -218,21 +218,21 @@ Adjust the placement of the 3 parts to make it look like a lamp. .. image:: img/csg_lamp.png -Create a CSGCombiner and name it ``bookshelf``. +Create a CSGCombiner3D and name it ``bookshelf``. -We will use 3 CSGBox nodes for the bookshelf. Create a CSGBox and adjust its +We will use 3 CSGBox3D nodes for the bookshelf. Create a CSGBox3D and adjust its dimensions; this will be the size of the bookshelf. .. image:: img/csg_shelf_big.png -Duplicate the CSGBox and shorten the dimensions of each axis and change the mode +Duplicate the CSGBox3D and shorten the dimensions of each axis and change the mode to **Subtraction**. .. image:: img/csg_shelf_subtract.png .. image:: img/csg_shelf_subtract_menu.png -You've almost built a shelf. Create one more CSGBox for dividing the shelf into +You've almost built a shelf. Create one more CSGBox3D for dividing the shelf into two levels. .. image:: img/csg_shelf.png @@ -261,7 +261,7 @@ to quickly apply textures to CSG-based levels. There are two ways to apply a material to a CSG node: -- Applying it to a CSGCombiner node as a material override +- Applying it to a CSGCombiner3D node as a material override (**Geometry > Material Override** in the Inspector). This will affect its children automatically, but will make it impossible to change the material in individual children. diff --git a/tutorials/animation/2d_skeletons.rst b/tutorials/animation/2d_skeletons.rst index 89cf7f6e5..53083b67b 100644 --- a/tutorials/animation/2d_skeletons.rst +++ b/tutorials/animation/2d_skeletons.rst @@ -56,7 +56,7 @@ Creating the polygons --------------------- Create a new scene for your model (if it's going to be an animated character, -you may want to use a ``KinematicBody2D``). For ease of use, an empty 2D node is +you may want to use a ``CharacterBody2D``). For ease of use, an empty 2D node is created as a root for the polygons. Begin with a ``Polygon2D`` node. There is no need to place it anywhere in the diff --git a/tutorials/animation/animation_tree.rst b/tutorials/animation/animation_tree.rst index 67b661f79..3aea4f668 100644 --- a/tutorials/animation/animation_tree.rst +++ b/tutorials/animation/animation_tree.rst @@ -33,7 +33,7 @@ This is how it's done in the `Third Person Shooter demo ` to control the character movement. +This can be fed to functions such as :ref:`CharacterBody3D.move_and_slide ` to control the character movement. There is also a tool node, ``RootMotionView``, that can be placed in a scene and will act as a custom floor for your character and animations (this node is disabled by default during the game). diff --git a/tutorials/best_practices/godot_interfaces.rst b/tutorials/best_practices/godot_interfaces.rst index 5786faa6a..6b07bf827 100644 --- a/tutorials/best_practices/godot_interfaces.rst +++ b/tutorials/best_practices/godot_interfaces.rst @@ -29,7 +29,7 @@ is to get a reference to an existing object from another acquired instance. Object obj = node.Object; // Property access. Object obj = node.GetObject(); // Method access. -The same principle applies for :ref:`Reference ` objects. +The same principle applies for :ref:`RefCounted ` objects. While users often access :ref:`Node ` and :ref:`Resource ` this way, alternative measures are available. diff --git a/tutorials/best_practices/logic_preferences.rst b/tutorials/best_practices/logic_preferences.rst index bb36995b7..cadcb56c9 100644 --- a/tutorials/best_practices/logic_preferences.rst +++ b/tutorials/best_practices/logic_preferences.rst @@ -130,7 +130,7 @@ consider: would be to unload the entire script. If they are instead loaded properties, then one can set them to ``null`` and remove all references to the resource entirely (which, as a - :ref:`Reference `-extending type, will cause the + :ref:`RefCounted `-extending type, will cause the resources to delete themselves from memory). Large levels: static vs. dynamic diff --git a/tutorials/best_practices/what_are_godot_classes.rst b/tutorials/best_practices/what_are_godot_classes.rst index 75ddfcb56..78f3fcbd3 100644 --- a/tutorials/best_practices/what_are_godot_classes.rst +++ b/tutorials/best_practices/what_are_godot_classes.rst @@ -41,8 +41,8 @@ available from the ``ClassDB``. .. note:: Even scripts that don't use the ``extends`` keyword implicitly inherit from the engine's base - :ref:`Reference ` class. As a result, you can instantiate scripts without the - ``extends`` keyword from code. Since they extend ``Reference`` though, you cannot attach them to + :ref:`RefCounted ` class. As a result, you can instantiate scripts without the + ``extends`` keyword from code. Since they extend ``RefCounted`` though, you cannot attach them to a :ref:`Node `. Scenes diff --git a/tutorials/math/beziers_and_curves.rst b/tutorials/math/beziers_and_curves.rst index 5c3347269..5ff892947 100644 --- a/tutorials/math/beziers_and_curves.rst +++ b/tutorials/math/beziers_and_curves.rst @@ -193,7 +193,7 @@ Curve2D, Curve3D, Path and Path2D There are two objects that contain curves: :ref:`Curve3D ` and :ref:`Curve2D ` (for 3D and 2D respectively). -They can contain several points, allowing for longer paths. It is also possible to set them to nodes: :ref:`Path ` and :ref:`Path2D ` (also for 3D and 2D respectively): +They can contain several points, allowing for longer paths. It is also possible to set them to nodes: :ref:`Path3D ` and :ref:`Path2D ` (also for 3D and 2D respectively): .. image:: img/bezier_path_2d.png diff --git a/tutorials/math/interpolation.rst b/tutorials/math/interpolation.rst index 409e2f06b..806762a38 100644 --- a/tutorials/math/interpolation.rst +++ b/tutorials/math/interpolation.rst @@ -96,7 +96,7 @@ Using the following pseudocode: Position3D p1 = GetNode("Position1"); Position3D p2 = GetNode("Position2"); - CSGMesh monkey = GetNode("Monkey"); + CSGMesh3D monkey = GetNode("Monkey"); monkey.Transform = p1.Transform.InterpolateWith(p2.Transform, _t); } diff --git a/tutorials/math/vector_math.rst b/tutorials/math/vector_math.rst index 6af91ce14..6555bab01 100644 --- a/tutorials/math/vector_math.rst +++ b/tutorials/math/vector_math.rst @@ -222,8 +222,8 @@ The surface normal has a value of ``(0, -1)`` because this is a horizontal surface. When the ball collides, we take its remaining motion (the amount left over when it hits the surface) and reflect it using the normal. In Godot, the :ref:`Vector2 ` class has a ``bounce()`` method to handle this. -Here is a GDScript example of the diagram above using a :ref:`KinematicBody2D -`: +Here is a GDScript example of the diagram above using a :ref:`CharacterBody2D +`: .. tabs:: diff --git a/tutorials/navigation/navigation_using_navigationagents.rst b/tutorials/navigation/navigation_using_navigationagents.rst index 8c3e5ba2a..0c7b811d0 100644 --- a/tutorials/navigation/navigation_using_navigationagents.rst +++ b/tutorials/navigation/navigation_using_navigationagents.rst @@ -3,22 +3,22 @@ Using NavigationAgents ====================== -NavigationsAgents are helper nodes to facilitate common calls to the NavigationServer API +NavigationsAgents are helper nodes to facilitate common calls to the NavigationServer API on behalf of the parent actor node in a more convenient manner for beginners. -2D and 3D version of NavigationAgents are available as -:ref:`NavigationAgent2D` and +2D and 3D version of NavigationAgents are available as +:ref:`NavigationAgent2D` and :ref:`NavigationAgent3D` respectively. -NavigationsAgents are entirely optional for navigation pathfinding. -The functionality of NavigationsAgents can be recreated with scripts and direct -calls to the NavigationServer API. If the default NavigationsAgent does not do what you want +NavigationsAgents are entirely optional for navigation pathfinding. +The functionality of NavigationsAgents can be recreated with scripts and direct +calls to the NavigationServer API. If the default NavigationsAgent does not do what you want for your game feel free to design your own NavigationsAgent with scripts. .. warning:: - NavigationsAgent nodes and NavigationServer ``agents`` are not the same. - The later is an RVO avoidance agent and solely used for avoidance. + NavigationsAgent nodes and NavigationServer ``agents`` are not the same. + The later is an RVO avoidance agent and solely used for avoidance. RVO avoidance agents are not involved in regular pathfinding. NavigationAgent Pathfinding @@ -27,23 +27,23 @@ NavigationAgent Pathfinding To use NavigationAgents for pathfinding, place a NavigationAgent2D/3D Node below a Node2D/3D inheriting parent node. To have the agent query a path to a target position use the ``set_target_location()`` method. -Once the target has been set, the next position to follow in the path -can be retrieved with the ``get_next_location()`` function. Move the parent actor node -to this position with your own movement code. On the next ``physics_frame``, call +Once the target has been set, the next position to follow in the path +can be retrieved with the ``get_next_location()`` function. Move the parent actor node +to this position with your own movement code. On the next ``physics_frame``, call ``get_next_location()`` again for the next position and repeat this until the path ends. NavigationAgents have their own internal logic to proceed with the current path and call for updates. NavigationAgents recognize by distance when a path point or the final target is reached. NavigationAgents refresh a path automatically when too far away from the current pathpoint. -The important updates are all triggered with the ``get_next_location()`` function +The important updates are all triggered with the ``get_next_location()`` function when called in ``_physics_process()``. -Be careful calling other NavigationAgent functions not required for path movement +Be careful calling other NavigationAgent functions not required for path movement while the actor is following a path, as many function trigger a full path refresh. .. note:: - New NavigationAgents will automatically join the + New NavigationAgents will automatically join the default navigation map for their 2D/3D dimension. .. warning:: @@ -68,8 +68,8 @@ They work well out of the box with :ref:`CharacterBody2D` NavigationAgent Avoidance ------------------------- -This section explains how to use the built-in avoidance specific -to NavigationAgent nodes. For general avoidance use and more technical details +This section explains how to use the built-in avoidance specific +to NavigationAgent nodes. For general avoidance use and more technical details on RVO avoidance see :ref:`doc_navigation_using_agent_avoidance`. @@ -87,8 +87,8 @@ The following NavigationAgent properties are relevant for avoidance: - The property ``neighbor_distance`` controls the search radius of the agent when searching for other agents that should be avoided. A lower value reduces processing cost. - The property ``max_neighbors`` controls how many other agents are considered in the avoidance calculation if they all have overlapping radius. A lower value reduces processing cost but a too low value may result in agents ignoring the avoidance. - - The property ``time_horizion`` controls the avoidance maneuver start and end distance. - How early and for how long an agents reacts to other agents within the ``neighbor_distance`` radius to correct its own velocity. + - The property ``time_horizion`` controls the avoidance maneuver start and end distance. + How early and for how long an agents reacts to other agents within the ``neighbor_distance`` radius to correct its own velocity. A lower value results in avoidance kicking in with a very intense velocity change at a short distance while a high value results in very early but small velocity changes. - The property ``max_speed`` controls the maximum velocity assumed for the agents avoidance calculation. If the agents parents moves faster than this value the avoidance ``safe_velocity`` might not be accurate enough to avoid collision. @@ -99,12 +99,12 @@ The ``velocity_computed`` signal of the agent node must be connected to receive Additional the current velocity of the agents parent must be set for the agent in ``_physics_process()`` with ``set_velocity()``. -After a short wait for processing the avoidance (still in the same frame) the ``safe_velocity`` vector will be received with the signal. +After a short wait for processing the avoidance (still in the same frame) the ``safe_velocity`` vector will be received with the signal. This velocity vector should be used to move the NavigationAgent's parent node in order to avoidance collision with other avoidance registered agents in proximity. RVO exists in its own space and has no information from navigation meshes or physics collision. Behind the scene avoidance agents are just circles with different radius on a flat plane. -In narrow places obstructed with collision objects, the avoidance maneuver radius needs to be +In narrow places obstructed with collision objects, the avoidance maneuver radius needs to be reduced considerably or disabled else the avoidance velocity will get actors stuck on collision easily. .. note:: @@ -113,19 +113,19 @@ reduced considerably or disabled else the avoidance velocity will get actors stu .. warning:: - Actors that move according to their avoidance agent velocity will not move at - full speed, can leave the navigation mesh bounds and can make movement + Actors that move according to their avoidance agent velocity will not move at + full speed, can leave the navigation mesh bounds and can make movement pauses when the avoidance simulation becomes unsolvable. -Using the NavigationAgent ``enable_avoidance`` property is the preferred option -to toggle avoidance but the following scripts for NavigationAgents can be +Using the NavigationAgent ``enable_avoidance`` property is the preferred option +to toggle avoidance but the following scripts for NavigationAgents can be used to create or delete avoidance callbacks for the agent RID. .. tabs:: .. code-tab:: gdscript GDScript extends NavigationAgent2D - + var agent : RID = get_rid() NavigationServer2D::get_singleton()->agent_set_callback(agent, self, "_avoidance_done") NavigationServer2D::get_singleton()->agent_set_callback(agent, null, "_avoidance_done") @@ -134,7 +134,7 @@ used to create or delete avoidance callbacks for the agent RID. .. code-tab:: gdscript GDScript extends NavigationAgent3D - + var agent : RID = get_rid() NavigationServer3D::get_singleton()->agent_set_callback(agent, self, "_avoidance_done") NavigationServer3D::get_singleton()->agent_set_callback(agent, null, "_avoidance_done") @@ -192,14 +192,14 @@ This script adds basic navigation movement to a CharacterBody3D with a Navigatio navigation_agent.set_target_location(movement_target) func _physics_process(delta): - + var next_path_position : Vector3 = navigation_agent.get_next_location() var current_agent_position : Vector3 = global_transform.origin var new_velocity : Vector3 = (next_path_position - current_agent_position).normalized() * movement_speed navigation_agent.set_velocity(new_velocity) func _on_NavigationAgent3D_velocity_computed(safe_velocity : Vector3): - # Move KinematicBody3D with the computed `safe_velocity` to avoid dynamic obstacles. + # Move CharacterBody3D with the computed `safe_velocity` to avoid dynamic obstacles. velocity = safe_velocity move_and_slide() @@ -220,12 +220,12 @@ This script adds basic navigation movement to a RigidBody3D with a NavigationAge navigation_agent.set_target_location(movement_target) func _physics_process(delta): - + var next_path_position : Vector3 = navigation_agent.get_next_location() var current_agent_position : Vector3 = global_transform.origin var new_velocity : Vector3 = (next_path_position - current_agent_position).normalized() * velocity navigation_agent.set_velocity(new_velocity) - + func _on_NavigationAgent3D_velocity_computed(safe_velocity : Vector3): # Move RigidBody3D with the computed `safe_velocity` to avoid dynamic obstacles. set_linear_velocity(safe_velocity) diff --git a/tutorials/performance/using_servers.rst b/tutorials/performance/using_servers.rst index 79e0edec4..02bab5af3 100644 --- a/tutorials/performance/using_servers.rst +++ b/tutorials/performance/using_servers.rst @@ -52,7 +52,7 @@ Most Godot nodes and resources contain these RIDs from the servers internally, a be obtained with different functions. In fact, anything that inherits :ref:`Resource ` can be directly casted to an RID. Not all resources contain an RID, though: in such cases, the RID will be empty. The resource can then be passed to server APIs as an RID. -.. Warning:: Resources are reference-counted (see :ref:`Reference `), and +.. Warning:: Resources are reference-counted (see :ref:`RefCounted `), and references to a resource's RID are *not* counted when determining whether the resource is still in use. Make sure to keep a reference to the resource outside the server, or else both it and its RID will be erased. diff --git a/tutorials/performance/vertex_animation/animating_thousands_of_fish.rst b/tutorials/performance/vertex_animation/animating_thousands_of_fish.rst index 0394dabd4..cf32a06b3 100644 --- a/tutorials/performance/vertex_animation/animating_thousands_of_fish.rst +++ b/tutorials/performance/vertex_animation/animating_thousands_of_fish.rst @@ -271,5 +271,5 @@ moving. You can move them by updating the per-instance transform for each fish e doing so will be faster than moving thousands of MeshInstances per frame, it'll still likely be slow. -In the next tutorial we will cover how to use :ref:`Particles ` to take advantage +In the next tutorial we will cover how to use :ref:`GPUParticles3D ` to take advantage of the GPU and move each fish around individually while still receiving the benefits of instancing. diff --git a/tutorials/performance/vertex_animation/controlling_thousands_of_fish.rst b/tutorials/performance/vertex_animation/controlling_thousands_of_fish.rst index 44de676bd..0b9a30fcd 100644 --- a/tutorials/performance/vertex_animation/controlling_thousands_of_fish.rst +++ b/tutorials/performance/vertex_animation/controlling_thousands_of_fish.rst @@ -8,7 +8,7 @@ update their transform array. It is great for placing many static objects around scene. But it is still difficult to move the objects around the scene. To make each instance move in an interesting way, we will use a -:ref:`Particles ` node. Particles take advantage of GPU acceleration +:ref:`GPUParticles3D ` node. Particles take advantage of GPU acceleration by computing and setting the per-instance information in a :ref:`Shader `. .. note:: Particles are not available in GLES2, instead use :ref:`CPUParticles `, @@ -48,7 +48,7 @@ Then add the following two functions: return x; } -These functions come from the default :ref:`ParticlesMaterial `. +These functions come from the default :ref:`ParticleProcessMaterial `. They are used to generate a random number from each particle's ``RANDOM_SEED``. A unique thing about particle shaders is that some built-in variables are saved across frames. @@ -138,7 +138,7 @@ This code gives you the following behavior: .. image:: img/scene.gif -Using a ParticlesMaterial you can make the fish behavior as simple or complex as you like. In this +Using a ParticleProcessMaterial you can make the fish behavior as simple or complex as you like. In this tutorial we only set Velocity, but in your own Shaders you can also set ``COLOR``, rotation, scale (through ``TRANSFORM``). Please refer to the :ref:`Particles Shader Reference ` for more information on particle shaders. diff --git a/tutorials/physics/index.rst b/tutorials/physics/index.rst index 10e8fd531..b359b4c15 100644 --- a/tutorials/physics/index.rst +++ b/tutorials/physics/index.rst @@ -8,7 +8,7 @@ Physics physics_introduction rigid_body using_area_2d - using_kinematic_body_2d + using_character_body_2d ray-casting ragdoll_system kinematic_character_2d diff --git a/tutorials/physics/kinematic_character_2d.rst b/tutorials/physics/kinematic_character_2d.rst index 936af697e..d8a6a34ac 100644 --- a/tutorials/physics/kinematic_character_2d.rst +++ b/tutorials/physics/kinematic_character_2d.rst @@ -56,7 +56,7 @@ or lose precision if the frame rate is too high or too low. .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody2D + extends CharacterBody2D func _physics_process(delta): pass @@ -66,7 +66,7 @@ or lose precision if the frame rate is too high or too low. using Godot; using System; - public class PhysicsScript : KinematicBody2D + public class PhysicsScript : CharacterBody2D { public override void _PhysicsProcess(float delta) { @@ -111,7 +111,7 @@ Moving the kinematic character Go back to the character scene, and open the script, the magic begins now! Kinematic body will do nothing by default, but it has a useful function called -:ref:`KinematicBody2D.move_and_collide() `. +:ref:`CharacterBody2D.move_and_collide() `. This function takes a :ref:`Vector2 ` as an argument, and tries to apply that motion to the kinematic body. If a collision happens, it stops right at the moment of the collision. @@ -121,7 +121,7 @@ So, let's move our sprite downwards until it hits the floor: .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody2D + extends CharacterBody2D func _physics_process(delta): move_and_collide(Vector2(0, 1)) # Move down 1 pixel per physics frame @@ -131,7 +131,7 @@ So, let's move our sprite downwards until it hits the floor: using Godot; using System; - public class PhysicsScript : KinematicBody2D + public class PhysicsScript : CharacterBody2D { public override void _PhysicsProcess(float delta) { @@ -149,7 +149,7 @@ little more like a regular game character: .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody2D + extends CharacterBody2D const GRAVITY = 200.0 var velocity = Vector2() @@ -165,7 +165,7 @@ little more like a regular game character: using Godot; using System; - public class PhysicsScript : KinematicBody2D + public class PhysicsScript : CharacterBody2D { const float gravity = 200.0f; Vector2 velocity; @@ -188,7 +188,7 @@ This adds basic support for walking when pressing left and right: .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody2D + extends CharacterBody2D const GRAVITY = 200.0 const WALK_SPEED = 200 @@ -216,7 +216,7 @@ This adds basic support for walking when pressing left and right: using Godot; using System; - public class PhysicsScript : KinematicBody2D + public class PhysicsScript : CharacterBody2D { const float gravity = 200.0f; const int walkSpeed = 200; diff --git a/tutorials/physics/physics_introduction.rst b/tutorials/physics/physics_introduction.rst index 3d828996f..6a5274261 100644 --- a/tutorials/physics/physics_introduction.rst +++ b/tutorials/physics/physics_introduction.rst @@ -47,7 +47,7 @@ The other three bodies extend :ref:`PhysicsBody2D `: ``RigidBody2D`` directly, but instead you apply forces to it (gravity, impulses, etc.) and the physics engine calculates the resulting movement. :ref:`Read more about using rigid bodies. ` -- :ref:`KinematicBody2D ` +- :ref:`CharacterBody2D ` A body that provides collision detection, but no physics. All movement and collision response must be implemented in code. @@ -233,16 +233,6 @@ A sleeping body acts like a static body, and its forces are not calculated by the physics engine. The body will wake up when forces are applied, either by a collision or via code. -Rigid body modes -~~~~~~~~~~~~~~~~ - -A rigid body can be set to one of four modes: - -- **Rigid** - The body behaves as a physical object. It collides with other bodies and responds to forces applied to it. This is the default mode. -- **Static** - The body behaves like a :ref:`StaticBody2D ` and does not move. -- **Character** - Similar to "Rigid" mode, but the body cannot rotate. -- **Kinematic** - The body behaves like a :ref:`KinematicBody2D ` and must be moved by code. - Using RigidBody2D ~~~~~~~~~~~~~~~~~ @@ -330,28 +320,28 @@ Contact monitoring via signals can be enabled via the :ref:`contact_monitor ` for the list of available signals. -KinematicBody2D +CharacterBody2D --------------- -:ref:`KinematicBody2D ` bodies detect collisions with +:ref:`CharacterBody2D ` bodies detect collisions with other bodies, but are not affected by physics properties like gravity or friction. Instead, they must be controlled by the user via code. The physics engine will -not move a kinematic body. +not move a character body. -When moving a kinematic body, you should not set its ``position`` directly. +When moving a character body, you should not set its ``position`` directly. Instead, you use the ``move_and_collide()`` or ``move_and_slide()`` methods. These methods move the body along a given vector, and it will instantly stop if a collision is detected with another body. After the body has collided, any collision response must be coded manually. -Kinematic collision response +Character collision response ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ After a collision, you may want the body to bounce, to slide along a wall, or to alter the properties of the object it hit. The way you handle collision -response depends on which method you used to move the KinematicBody2D. +response depends on which method you used to move the CharacterBody2D. -:ref:`move_and_collide ` +:ref:`move_and_collide ` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ When using ``move_and_collide()``, the function returns a @@ -365,7 +355,7 @@ occurred: .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody2D + extends CharacterBody2D var velocity = Vector2(250, 250) @@ -376,7 +366,7 @@ occurred: .. code-tab:: csharp - class Body : KinematicBody2D + class Body : CharacterBody2D { private Vector2 _velocity = new Vector2(250, 250); @@ -395,7 +385,7 @@ Or to bounce off of the colliding object: .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody2D + extends CharacterBody2D var velocity = Vector2(250, 250) @@ -406,7 +396,7 @@ Or to bounce off of the colliding object: .. code-tab:: csharp - class Body : KinematicBody2D + class Body : CharacterBody2D { private Vector2 _velocity = new Vector2(250, 250); @@ -418,7 +408,7 @@ Or to bounce off of the colliding object: } } -:ref:`move_and_slide ` +:ref:`move_and_slide ` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sliding is a common collision response; imagine a player moving along walls @@ -437,7 +427,7 @@ the ground (including slopes) and jump when standing on the ground: .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody2D + extends CharacterBody2D var run_speed = 350 var jump_speed = -1000 @@ -465,7 +455,7 @@ the ground (including slopes) and jump when standing on the ground: .. code-tab:: csharp - class Body : KinematicBody2D + class Body : CharacterBody2D { private float _runSpeed = 350; private float _jumpSpeed = -1000; diff --git a/tutorials/physics/ragdoll_system.rst b/tutorials/physics/ragdoll_system.rst index f74afae3f..5d678f2be 100644 --- a/tutorials/physics/ragdoll_system.rst +++ b/tutorials/physics/ragdoll_system.rst @@ -79,7 +79,7 @@ You can also limit the simulation to only a few bones. To do so, pass the bone n Collision layer and mask ~~~~~~~~~~~~~~~~~~~~~~~~ -Make sure to set up your collision layers and masks properly so the ``KinematicBody``'s capsule doesn't get in the way of the physics simulation: +Make sure to set up your collision layers and masks properly so the ``CharacterBody3D``'s capsule doesn't get in the way of the physics simulation: .. image:: img/ragdoll_layer.png diff --git a/tutorials/physics/ray-casting.rst b/tutorials/physics/ray-casting.rst index 27347de62..54d4f0e1f 100644 --- a/tutorials/physics/ray-casting.rst +++ b/tutorials/physics/ray-casting.rst @@ -163,13 +163,13 @@ as shown in the following image: To avoid self-intersection, the ``intersect_ray()`` function can take an optional third parameter which is an array of exceptions. This is an -example of how to use it from a KinematicBody2D or any other +example of how to use it from a CharacterBody2D or any other collision object node: .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody2D + extends CharacterBody2D func _physics_process(delta): var space_state = get_world_2d().direct_space_state @@ -177,7 +177,7 @@ collision object node: .. code-tab:: csharp - class Body : KinematicBody2D + class Body : CharacterBody2D { public override void _PhysicsProcess(float delta) { @@ -202,7 +202,7 @@ member variable: .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody2D + extends CharacterBody2D func _physics_process(delta): var space_state = get_world().direct_space_state @@ -211,7 +211,7 @@ member variable: .. code-tab:: csharp - class Body : KinematicBody2D + class Body : CharacterBody2D { public override void _PhysicsProcess(float delta) { diff --git a/tutorials/physics/using_area_2d.rst b/tutorials/physics/using_area_2d.rst index c1fc88ae1..071118a90 100644 --- a/tutorials/physics/using_area_2d.rst +++ b/tutorials/physics/using_area_2d.rst @@ -61,7 +61,7 @@ Here's the node setup for the coin: To detect the overlap, we'll connect the appropriate signal on the Area2d. Which signal to use depends on the player's node type. If the player is another area, -use ``area_entered``. However, let's assume our player is a ``KinematicBody2D`` +use ``area_entered``. However, let's assume our player is a ``CharacterBody2D`` (and therefore a ``CollisionObject2D`` type), so we'll connect the ``body_entered`` signal. diff --git a/tutorials/physics/using_kinematic_body_2d.rst b/tutorials/physics/using_character_body_2d.rst similarity index 95% rename from tutorials/physics/using_kinematic_body_2d.rst rename to tutorials/physics/using_character_body_2d.rst index 45eac2843..5363c8e88 100644 --- a/tutorials/physics/using_kinematic_body_2d.rst +++ b/tutorials/physics/using_character_body_2d.rst @@ -1,6 +1,6 @@ -.. _doc_using_kinematic_body_2d: +.. _doc_using_character_body_2d: -Using KinematicBody2D +Using CharacterBody2D ===================== Introduction @@ -10,32 +10,32 @@ Godot offers several collision objects to provide both collision detection and response. Trying to decide which one to use for your project can be confusing. You can avoid problems and simplify development if you understand how each of them works and what their pros and cons are. In this tutorial, we'll look at the -:ref:`KinematicBody2D ` node and show some examples +:ref:`CharacterBody2D ` node and show some examples of how to use it. .. note:: This document assumes you're familiar with Godot's various physics bodies. Please read :ref:`doc_physics_introduction` first. -What is a kinematic body? +What is a character body? ------------------------- -``KinematicBody2D`` is for implementing bodies that are controlled via code. -Kinematic bodies detect collisions with other bodies when moving, but are not affected by +``CharacterBody2D`` is for implementing bodies that are controlled via code. +Character bodies detect collisions with other bodies when moving, but are not affected by engine physics properties, like gravity or friction. While this means that you have to write some code to create their behavior, it also means you have more precise control over how they move and react. -.. tip:: A `KinematicBody2D` can be affected by gravity and other forces, +.. tip:: A `CharacterBody2D` can be affected by gravity and other forces, but you must calculate the movement in code. The physics engine will - not move a `KinematicBody2D`. + not move a `CharacterBody2D`. Movement and collision ---------------------- -When moving a ``KinematicBody2D``, you should not set its ``position`` property +When moving a ``CharacterBody2D``, you should not set its ``position`` property directly. Instead, you use the ``move_and_collide()`` or ``move_and_slide()`` methods. These methods move the body along a given vector and instantly stop if -a collision is detected with another body. After a KinematicBody2D has collided, +a collision is detected with another body. After a CharacterBody2D has collided, any *collision response* must be coded manually. .. warning:: You should only do Kinematic body movement in the ``_physics_process()`` callback. @@ -129,7 +129,7 @@ and ``get_slide_collision()``: for i in get_slide_count(): var collision = get_slide_collision(i) print("I collided with ", collision.collider.name) - + .. code-tab:: csharp // Using MoveAndCollide. @@ -216,7 +216,7 @@ Movement and walls If you've downloaded the sample project, this example is in "BasicMovement.tscn". -For this example, add a ``KinematicBody2D`` with two children: a ``Sprite2D`` and a +For this example, add a ``CharacterBody2D`` with two children: a ``Sprite2D`` and a ``CollisionShape2D``. Use the Godot "icon.png" as the Sprite2D's texture (drag it from the Filesystem dock to the *Texture* property of the ``Sprite2D``). In the ``CollisionShape2D``'s *Shape* property, select "New RectangleShape2D" and @@ -224,12 +224,12 @@ size the rectangle to fit over the sprite image. .. note:: See :ref:`doc_2d_movement` for examples of implementing 2D movement schemes. -Attach a script to the KinematicBody2D and add the following code: +Attach a script to the CharacterBody2D and add the following code: .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody2D + extends CharacterBody2D var speed = 250 var velocity = Vector2() @@ -256,7 +256,7 @@ Attach a script to the KinematicBody2D and add the following code: using Godot; using System; - public class KBExample : KinematicBody2D + public class KBExample : CharacterBody2D { public int Speed = 250; private Vector2 _velocity = new Vector2(); @@ -294,7 +294,7 @@ some obstacles. Add a :ref:`StaticBody2D ` with a rectangular collision shape. For visibility, you can use a sprite, a Polygon2D, or turn on "Visible Collision Shapes" from the "Debug" menu. -Run the scene again and try moving into the obstacle. You'll see that the ``KinematicBody2D`` +Run the scene again and try moving into the obstacle. You'll see that the ``CharacterBody2D`` can't penetrate the obstacle. However, try moving into the obstacle at an angle and you'll find that the obstacle acts like glue - it feels like the body gets stuck. @@ -325,7 +325,7 @@ uses the mouse pointer. Here is the code for the Player, using ``move_and_slide( .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody2D + extends CharacterBody2D var Bullet = preload("res://Bullet.tscn") var speed = 200 @@ -360,7 +360,7 @@ uses the mouse pointer. Here is the code for the Player, using ``move_and_slide( using Godot; using System; - public class KBExample : KinematicBody2D + public class KBExample : CharacterBody2D { private PackedScene _bullet = (PackedScene)GD.Load("res://Bullet.tscn"); public int Speed = 200; @@ -411,7 +411,7 @@ And the code for the Bullet: .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody2D + extends CharacterBody2D var speed = 750 var velocity = Vector2() @@ -436,7 +436,7 @@ And the code for the Bullet: using Godot; using System; - public class Bullet : KinematicBody2D + public class Bullet : CharacterBody2D { public int Speed = 750; private Vector2 _velocity = new Vector2(); @@ -498,7 +498,7 @@ Here's the code for the player body: .. tabs:: .. code-tab:: gdscript GDScript - extends KinematicBody2D + extends CharacterBody2D export (int) var run_speed = 100 export (int) var jump_speed = -400 @@ -533,7 +533,7 @@ Here's the code for the player body: using Godot; using System; - public class KBExample : KinematicBody2D + public class KBExample : CharacterBody2D { [Export] public int RunSpeed = 100; [Export] public int JumpSpeed = -400; diff --git a/tutorials/rendering/gles2_gles3_differences.rst b/tutorials/rendering/gles2_gles3_differences.rst index 66c7dabc5..8085aa9ab 100644 --- a/tutorials/rendering/gles2_gles3_differences.rst +++ b/tutorials/rendering/gles2_gles3_differences.rst @@ -14,12 +14,12 @@ of bugs. There may be differences that are unintentional, but they should be rep Particles --------- -GLES2 cannot use the :ref:`Particles ` or :ref:`Particles2D ` nodes +GLES2 cannot use the :ref:`GPUParticles3D ` or :ref:`GPUParticles2D ` nodes as they require advanced GPU features. Instead, use :ref:`CPUParticles ` or :ref:`CPUParticles2D `, which provides a similar interface to a -:ref:`ParticlesMaterial `. +:ref:`ParticleProcessMaterial `. -.. tip:: Particles and Particles2D can be converted to their CPU equivalent node with the "Convert to +.. tip:: Particles and GPUParticles2D can be converted to their CPU equivalent node with the "Convert to CPUParticles" option in the editor. ``SCREEN_TEXTURE`` mip-maps diff --git a/tutorials/scripting/gdscript/gdscript_styleguide.rst b/tutorials/scripting/gdscript/gdscript_styleguide.rst index 74d5a08ca..776f42eec 100644 --- a/tutorials/scripting/gdscript/gdscript_styleguide.rst +++ b/tutorials/scripting/gdscript/gdscript_styleguide.rst @@ -620,7 +620,7 @@ Use PascalCase for class and node names: :: - extends KinematicBody + extends CharacterBody3D Also use PascalCase when loading a class into a constant or a variable: diff --git a/tutorials/scripting/gdscript/static_typing.rst b/tutorials/scripting/gdscript/static_typing.rst index 66ce19c81..e965fa3e5 100644 --- a/tutorials/scripting/gdscript/static_typing.rst +++ b/tutorials/scripting/gdscript/static_typing.rst @@ -149,7 +149,7 @@ Type casting is a key concept in typed languages. Casting is the conversion of a value from one type to another. Imagine an Enemy in your game, that ``extends Area2D``. You want it to -collide with the Player, a ``KinematicBody2D`` with a script called +collide with the Player, a ``CharacterBody2D`` with a script called ``PlayerController`` attached to it. You use the ``on_body_entered`` signal to detect the collision. With typed code, the body you detect is going to be a generic ``PhysicsBody2D``, and not your @@ -198,7 +198,7 @@ don't care about the node's type as long as it has the methods you need to call. You can use casting to tell Godot the type you expect when you get a -node: ``($Timer as Timer)``, ``($Player as KinematicBody2D)``, etc. +node: ``($Timer as Timer)``, ``($Player as CharacterBody2D)``, etc. Godot will ensure the type works and if so, the line number will turn green at the left of the script editor. diff --git a/tutorials/scripting/resources.rst b/tutorials/scripting/resources.rst index 7a7e91a6c..2a952e4a9 100644 --- a/tutorials/scripting/resources.rst +++ b/tutorials/scripting/resources.rst @@ -80,7 +80,7 @@ There are two ways to load resources from code. First, you can use the ``load()` func _ready(): # Godot loads the Resource when it reads this very line. - var imported_resource = load("res://robi.png") + var imported_resource = load("res://robi.png") $sprite.texture = imported_resource .. code-tab:: csharp @@ -165,7 +165,7 @@ This comes with many distinct advantages over alternative data structures, such as JSON, CSV, or custom TXT files. Users can only import these assets as a :ref:`Dictionary ` (JSON) or as a :ref:`File ` to parse. What sets Resources apart is their -inheritance of :ref:`Object `, :ref:`Reference `, +inheritance of :ref:`Object `, :ref:`RefCounted `, and :ref:`Resource ` features: - They can define constants, so constants from other data fields or objects are not needed. @@ -210,7 +210,7 @@ Attach a script to it named ``bot_stats.gd`` (or just create a new script, and t .. tabs:: .. code-tab:: gdscript GDScript extends Resource - + @export var health : int @export var sub_resource : Resource @export var strings : PackedStringArray @@ -222,7 +222,7 @@ Attach a script to it named ``bot_stats.gd`` (or just create a new script, and t health = p_health sub_resource = p_sub_resource strings = p_strings - + .. code-tab:: csharp // BotStats.cs @@ -252,9 +252,9 @@ Attach a script to it named ``bot_stats.gd`` (or just create a new script, and t } } } - + Now, create a :ref:`CharacterBody3D `, name it ``Bot``, and add the following script to it: - + .. tabs:: .. code-tab:: gdscript GDScript extends CharacterBody3D @@ -265,9 +265,9 @@ Now, create a :ref:`CharacterBody3D `, name it ``Bot``, a # Uses an implicit, duck-typed interface for any 'health'-compatible resources. if stats: stats.health = 10 - print(stats.health) + print(stats.health) # Prints "10" - + .. code-tab:: csharp // Bot.cs using System; @@ -287,7 +287,7 @@ Now, create a :ref:`CharacterBody3D `, name it ``Bot``, a } } } - + Now, select the :ref:`CharacterBody3D ` node which we named ``bot``, and drag&drop the ``bot_stats.tres`` resource onto the Inspector. It should print 10! Obviously, this setup can be used for more advanced features than this, but as long you really understand *how* it all worked, you should figure out everything else related to Resources. .. note:: diff --git a/tutorials/shaders/shader_materials.rst b/tutorials/shaders/shader_materials.rst index 4185390ca..4c333e705 100644 --- a/tutorials/shaders/shader_materials.rst +++ b/tutorials/shaders/shader_materials.rst @@ -8,7 +8,7 @@ Introduction For the most common cases, Godot provides ready to use materials for most types of shaders, such as :ref:`StandardMaterial3D `, -:ref:`CanvasItemMaterial ` and :ref:`ParticlesMaterial `. +:ref:`CanvasItemMaterial ` and :ref:`ParticleProcessMaterial `. They are flexible implementations that cover most use cases. Shader materials allow writing a custom shader directly, for maximum flexibility. @@ -70,7 +70,7 @@ Converting to ShaderMaterial ---------------------------- It is possible to convert from StandardMaterial3D, CanvasItemMaterial and -ParticlesMaterial to ShaderMaterial. To do so, go to the material properties +ParticleProcessMaterial to ShaderMaterial. To do so, go to the material properties and select the convert option. .. image:: img/shader_material_convert.png diff --git a/tutorials/shaders/your_first_shader/your_first_3d_shader.rst b/tutorials/shaders/your_first_shader/your_first_3d_shader.rst index b9d8ec587..b37fcfb7a 100644 --- a/tutorials/shaders/your_first_shader/your_first_3d_shader.rst +++ b/tutorials/shaders/your_first_shader/your_first_3d_shader.rst @@ -42,8 +42,8 @@ program (e.g. Blender). But Godot also has a few :ref:`PrimitiveMeshes importing Meshes. There are multiple node types that you can use to draw a mesh. The main one is -:ref:`MeshInstance `, but you can also use :ref:`Particles -`, :ref:`MultiMeshes ` (with a +:ref:`MeshInstance `, but you can also use :ref:`GPUParticles3D +`, :ref:`MultiMeshes ` (with a :ref:`MultiMeshInstance `), or others. Typically, a material is associated with a given surface in a mesh, but some